Skip to content
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

Add file:/// handling in download tool #2635

Merged
merged 2 commits into from Jul 27, 2022

Conversation

jcar87
Copy link
Contributor

@jcar87 jcar87 commented Jul 6, 2022

Docs for conan-io/conan#11569

Ability for conan.tools.files.get() and conan.tools.files.download() to retrieve files from the local filesystem referenced with a file:/// URI.

@@ -127,9 +129,13 @@ Examples:
# Download and check file checksum
download(self, "http://someurl/somefile.zip", "myfilename.zip", md5="e5d695597e9fa520209d1b41edad2a27")

# Retrieve file that is visible in the local filesystem
tools.download("file:///home/myuser/downloads/somefile.zip", "myfilename.zip", md5="e5d695597e9fa520209d1b41edad2a27")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. an example with Windows path (e.g. with C: drive) would be useful
  2. does it work with relative path? if so, what are they relative to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with those, clarifying that would be nice

@czoido czoido added this to the 1.51 milestone Jul 26, 2022
@jcar87
Copy link
Contributor Author

jcar87 commented Jul 26, 2022

I've added an example of a windows path (file:///C:/), as all as a clarification that this is for absolute paths.

Relative references as per RFC 8089 only make sense in the context of a "base" URI - I imagine that's intended for web pages that are loaded from a URI that contain links relative to the current page, where the browser resolves the relative reference to a URI.
This is not the case here: we require the the URIs to start with file:// and as such, it needs to be an absolute path as specified by the RFC

@czoido czoido merged commit 0384c39 into conan-io:develop Jul 27, 2022
@jcar87 jcar87 deleted the feature/file-tools-get-local-file-uri branch July 27, 2022 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants