Community
Participate
Working Groups
I20100720-0800 Linux/GTK Open in external web browser does not work for file with space in path - Have "Preferences > General > Web Browser" set to use "Firefox" as external browser (location /usr/bin/firefox, no parameters). - Open a file from the Package Explorer with a space in the path name (e.g. "hello world.html"). => Opens Firefox with multiple tabs, with locations separated at the spaces. - Works fine with the "Default system web browser". - Works fine on WinXP. Looks like the problem is that MozillaBrowser#openURL(URL) does not encode the space character on Linux. The "replace spaces by %20" code looks incomplete anyway. You might want to try "URIUtil.toURI(url2).toASCIIString()" (at all 3 places where you insert "%20").
Reproduced on Red Hat Linux using I20101012-0800.
Created attachment 180921 [details] Patch
Created attachment 180934 [details] Better patch Trying to encode the URL yourself is doomed to fail. E.g. I still can't open a file named ab#c.html on Windows. Here's a better fix that encodes the URL using URI#toASCIIString() (in all 3 affected places).
I agree, your fix is better. Committed to HEAD.
I'm going to reopen this, since the fix causes problems in other cases (in I20110308-2000). When I e.g. use "Project > Generate Javadoc..." and choose a folder with spaces as target, then "Navigate > Open Attached Javadoc" doesn't work. I think real reason for the problems with spaces is in org.eclipse.ui.internal.browser.BrowserLauncher, which calls "file.toFile().toURL()" (twice). A better solution is to use "file.toFile().toURI().toURL()" instead. File#toURL() is actually broken and has been deprecated in JavaSE 1.6. It looks like URIUtil#toURI(URL) is just meant as a workaround for bad URLs and should be avoided if possible (bug 339422). That would also solve the problem that made me file bug 337479.
Created attachment 190796 [details] Fix 3 Proposed fix on HEAD. Tested with all browser settings on Windows (7). Needs testing on Linux and Mac.
Created attachment 190948 [details] Fix 4 Grrr, that bug 294650 drives me crazy! Here's the complete patch.
Works fine on Cocoa. Only catch is bug 339655, but that was also there before.
Also good on GTK. There, fragments are cut away (bug 339671), but that's also nothing new.
It tests out fine for me also with a variety of non alpanumeric characters and non ASCII characters. Patch committed to HEAD.
Still happens in 3.7.1: 1. Create a link to firefox, containing whitespace character: # ln -s firefox "My Browser" 2. Add this Web browser using the preference page. 3. External browser doesn't open. Please see the attached patch that fixes the problem.
Created attachment 210039 [details] Patch that uses cmdarray when calling exec
Michael, the 3.7.x branch is closed now. If you still see the problems from comment 11, please open a new bug (also since your problem is different from the subject of this bug).