-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
The Parse function in the net/url package does not properly handle a file URL with a Windows path. It should place the entire local path after the file:// in the Path field on the URL object, as on Unix/Linux, but it does not. If the path is specified entirely using backslashes, then it will be placed in the Host field. If it is specified using forward slashes or some combination of backslashes and forward slashes, then the portion before the first forward slash will be placed in the Host field and the remainder will be placed in the Path field. For example, the URL file://C:\Windows\System32\kernel32.dll parses to {Host: "C:\Windows\System32\kernel32.dll"} and the URL file://C:\Windows\System32/kernel32.dll parses to {Host: "C:\Windows\System32", Path: "/kernel32.dll"}. They should instead parse to {Path: "C:\Windows\System32\kernel32.dll"} and {Path: "C:\Windows\System32/kernel32.dll"}, respectively.