New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 599146 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Aug 21
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Windows Chrome cannot open paths that contain '%' via command line

Project Member Reported by stefanvirtanen@google.com, Mar 30 2016

Issue description

Version: 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.

 
Alternative reproduction:
(1) Download any PDF
(2) Rename PDF to "2016-01-01.%5BPBS%5DEmergingProducts-Search--NA.MasterCard.999999.CustomerSignedAgreement (1).pdf"
(3) Try to open PDF in Chrome

Comment 2 by fukino@chromium.org, Apr 14 2016

Components: -Platform>Apps>FileManager
Removing FileManager from components, since it is Chrome OS specific.
Project Member

Comment 3 by sheriffbot@chromium.org, Jun 3 2016

Labels: Hotlist-Google

Comment 4 by npm@chromium.org, Oct 25 2016

Components: UI>Browser>Downloads
Labels: -OS-Windows OS-All
Reproduced on Linux and Mac too. +Downloads because they are probably the ones handling file paths?

Comment 5 by asanka@chromium.org, Oct 26 2016

Cc: asanka@chromium.org abarth@chromium.org
Components: -Internals>Plugins>PDF -UI>Browser>Downloads UI>Browser>Core
Labels: -OS-All OS-Windows
Summary: Windows Chrome cannot open paths that contain '%' via command line (was: Windows Chrome parsing file location incorrectly)
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.
Status: Archived (was: Untriaged)
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!

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