Windows Chrome cannot open paths that contain '%' via command line |
||||||
Issue descriptionVersion: Latest as of March 30th, 2016 OS: Windows 7 What steps will reproduce the problem? (1) Download PDF file with name: "2016-01-01.%5BPBS%5DEmergingProducts-Search--NA.MasterCard.999999.CustomerSignedAgreement (1).pdf" (2) Try to open pdf in Chrome (3) Fail due to "File not found" What is the expected output? File is correctly opened. What do you see instead? File does not open. Please use labels and text to provide additional information.
,
Apr 14 2016
Removing FileManager from components, since it is Chrome OS specific.
,
Jun 3 2016
,
Oct 25 2016
Reproduced on Linux and Mac too. +Downloads because they are probably the ones handling file paths?
,
Oct 26 2016
The file opens correctly if it is dragged and dropped on Chrome or if you open via Ctrl+O. However, if you open it via a file association or via the commandline, then the file: URL that Chrome sees at navigation time is: file:///.../2016-01-01.%5BPBS%5DEmergingProducts-Search--NA.MasterCard.999999.CustomerSignedAgreement%20(1).pdf The correct file URL is: file:///.../2016-01-01.%255BPBS%255DEmergingProducts-Search--NA.MasterCard.999999.CustomerSignedAgreement%20(1).pdf The incorrect file URL results in an attempt to open a file named "2016-01-01.[PBS]EmergingProducts-Search--NA.MasterCard.999999.CustomerSignedAgreement (1).pdf" which, of course, doesn't exist. The problem is, I believe, in GURL. The code in https://cs.chromium.org/chromium/src/url/url_util.cc?rcl=1477451763&l=173 attempts to parse an absolute path as a file:/// URL on Windows. However, in doing so it attempts to parse the path as the path portion of a file:/// URL. Consequently, it doesn't escape % characters it finds on the path. On a valid file:/// URL all '%' characters should be expected to start percent escape sequences. This is not a correct assumption to make regarding a file path. This logic in invoked in StartupBrowserCreator::GetURLsFromCommandLine (https://cs.chromium.org/chromium/src/chrome/browser/ui/startup/startup_browser_creator.cc?rcl=1477451763&l=484). Hence paths that contain '%' cannot be opened via the command line. Note that net::FilePathToFileURL and net::FileURLToFilePath correctly handles paths with '%' characters in them. The latter is used to map a file:/// URL back to a FilePath for the purpose of opening it. +abarth for /url/OWNERS. Also adding UI>Browser>Core for lack of a better component.
,
Aug 21
Archiving old bugs that haven't been actively assigned in over a year. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!
,
Aug 21
Archiving old bugs that haven't been actively assigned in over a year. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks! |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by stefanvirtanen@google.com
, Mar 30 2016