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

"file:" schema not supported, only recognises "file://" (with an empty authority) as a valid file URI #7

Open
jhoag opened this issue Apr 13, 2018 · 2 comments

Comments

@jhoag
Copy link

jhoag commented Apr 13, 2018

The definition of a URI is:
scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]
(https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#URL_and_URN)

So the // is optional. At the moment, the validation fails unless the slashes are included.

Expected
Any URI starting with "file:" is accepted

Actual
URIs are rejected unless they begin"file://"

This is causing issues when using this library in a system with URIs produced by other libraries.

@jhoag jhoag changed the title "file:" schema not supported, only recognised "file://" (with an empty authority) as a valid file URI "file:" schema not supported, only recognises "file://" (with an empty authority) as a valid file URI Apr 13, 2018
@xmedeko
Copy link

xmedeko commented Oct 9, 2019

The validation should strip any number of slashes after file:.
Consider everything after file: as a path and OS/app may accept any number of slashes at the path start. Even if it's not correct, many apps accept that (e.g. MS Windows), so a user may enter such URI and we want to handle that, too.

@xmedeko
Copy link

xmedeko commented Oct 10, 2019

I see Node.js has a function url.fileURLToPath since v10.12.0.

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

No branches or pull requests

2 participants