Skip to content

✨ special treatment of file urls #672

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

m0ppers
Copy link

@m0ppers m0ppers commented Nov 11, 2023

I want relative file: urls in my application which are not allowed as per spec so I started searching for alternative implementations.

this parser ALMOST worked. I added what was missing for my usecase. Not sure what you think? Is it worthwhile to support it? do you even want an explicit divergence from the spec?

@chrmod
Copy link
Member

chrmod commented Nov 17, 2023

@m0ppers very interesting case, thanks for raising it up!

It's unclear what's the best way to move but I think we should strive for correctness and unambiguity.

After looking at Wikipedia article on File URI scheme, URL Standard and your examples, I think we may want to support URLs like file://hostname/file but others may be problem as it is unclear how they should be interpreted.

Both other URLs fail the URL Standard due to an error special-scheme-missing-following-solidus, which could be avoided with different representation:

  • file:/test -> file:///test
  • file:test -> file://./test

What do you think?

@m0ppers
Copy link
Author

m0ppers commented Nov 20, 2023

thanks for getting back. yes I think you are right. I find the urlspec very difficult to read and I found https://www.rfc-editor.org/rfc/rfc8089#appendix-F which lists a few other possibilties to denote file urls and I liked it :)

Personally I find the authority stuff in file URLs super strange. I am not sure if there is a single implementation that will be able to resolve an URL like file://hostname/test to an actual file.

I am ok with using the WHATWGish approach (i.e. file:///test). however I am unsure if it is really a good idea to use file://./test (. could be interpreted as a hostname making it ambiguous. that is why I liked the RFC approach - they also do not allow relative file URLs but there is no ambiguity there imho).

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.

2 participants