-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file urls do not work on windows #78
Comments
I have this working on my own fork with the following: class FILE
def initialize(_url, _options)
end
def normalize_path(uri)
# URI for windows does not work as expected and returns a path without the root drive
# this attempts to fix that
if /^file:\/{2}([a-z,A-Z]?)/.match(uri.to_s) # file://c:/one/two/three.zip
uri.to_s.gsub(/^file:\/{2}([a-z,A-Z])?/, "#{$1}:")
else
uri.path
end
end
def download(uri, file_path)
src_path = normalize_path(uri)
FileUtils.copy(src_path, file_path)
end
end If this is acceptable I can make a PR. |
file:///d:/OSS/one/two/three.zip is technically correct, because I think file://d:/OSS/one/two/three.zip, would be host = d:, path = OSS, and this patch is implementing the wrong behavior (puppet:/// and not puppet:// because puppet://{server}/). So maybe implementing #77 is the better approach, because this is not intuitive for Windows. |
* Fix local files for non faraday providers * Fix voxpupuliGH-77 allows local files to be specified without using file:/// * Fix voxpupuliGH-78 allow local file:///c:/... on windows
* Fix local files for non faraday providers * Fix voxpupuliGH-77 allows local files to be specified without using file:/// * Fix voxpupuliGH-78 allow local file:///c:/... on windows
* Fix local files for non faraday providers * Fix voxpupuliGH-77 allows local files to be specified without using file:/// * Fix voxpupuliGH-78 allow local file:///c:/... on windows
* Fix local files for non faraday providers * Fix voxpupuliGH-77 allows local files to be specified without using file:/// * Fix voxpupuliGH-78 allow local file:///c:/... on windows
Because windows has to be different...
The URI ruby library does not work as expected on windows because of the fact there is no root drive. So files fail to download because the urls are interpreted incorrectly.
Example:
And adding another slash produces another issue
This should be d:/OSS/one/two/three.zip
The text was updated successfully, but these errors were encountered: