-
Notifications
You must be signed in to change notification settings - Fork 24
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
Handle local archives without requiring network tooling #65
Conversation
|
||
defp local_archive("file:" <> rest) do | ||
case rest do | ||
"//localhost/" <> path -> "/" <> path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we don't support reading from any other host either, I would remove this version.
case rest do | ||
"//localhost/" <> path -> "/" <> path | ||
"///" <> path -> "/" <> path | ||
"/" <> path when binary_part(path, 0, 1) != "/" -> rest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should support this version. I can't see it on the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it seems to be used by KDE. I am 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RFC 3986 mentions that:
the "file" URI scheme is defined so that no authority, an empty host, and "localhost" all mean the end-user's machine
defp local_archive("file:" <> rest) do | ||
case rest do | ||
"//localhost/" <> path -> "/" <> path | ||
"///" <> path -> "/" <> path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't support "file:///c:/foo/bar" on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to test on Windows; we have to rewrite that to use backslashes, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's not necessary, but you don't need to add a prefixing "/". Using a separate env var will be simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to add a prefixing "/"
Indeed. 🙈
I am not a big fan of this approach. The current implementation is too complex by trying to support three different formats and it does not work on Windows. Perhaps it would make more sense to introduce another environment variable, instead of overloading this one? |
@josevalim I just thought the same, we can have |
I'm personally also not that positive about supporting |
@lexmag there's still the advantage of not creating a copy of the file at all. And having an env var for path makes it much more intuitive/discoverable. I don't think prioritisation is an issue, we can check the path before url, similarly to how we respect Lines 22 to 29 in 137ca69
|
We now use httpc for requests and I've just added support for |
No description provided.