| Summary: | [Browser] Open in external web browser does not work for file with space or # in path | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Markus Keller <markus.kell.r> | ||||||||||||
| Component: | User Assistance | Assignee: | Chris Goldthorpe <cgold> | ||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | cgold, spektom | ||||||||||||
| Version: | 3.7 | ||||||||||||||
| Target Milestone: | 3.7 M7 | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | All | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Bug Depends on: | |||||||||||||||
| Bug Blocks: | 415061 | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Markus Keller
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). |