Code Monkey home page Code Monkey logo

Comments (4)

eode avatar eode commented on July 16, 2024 1

Weigh in from him is that there's no such thing as (filesystem) relative paths, and that the file scheme doesn't accept them and won't handle them.

I.e., the file scheme only handles URI-style relativity, not system-style relativity.

from uri.

amcgregor avatar amcgregor commented on July 16, 2024

file: is a URL-like protocol (utilizing URL-like :// scheme separator resolution), meaning file://relativepath is declaring an authority of "relativepath", with no path. URI('file:///rootedpath').pathPurePosixPath('/rootedpath'). Because of it being URL-like, you're mostly right, the path can not easily start with two slashes. Or, rather, to begin with two slashes, you'd need four consecutive ones: URI('file:////foo').pathPurePosixPath('//foo') — similarly, use of just a colon to separate the scheme from remainder results in the remainder only being interpreted as path (e.g. as per isbn:); no possibility for authority or other URL structure. (Basically, doing that you're forcing it to be treated as a bare relative path, but notice the repr: URI('file:relativepath')URI('file://relativepath'))

There's a lot of confusion around URI : schemes and URL :// schemes; I'll need to investigate how to properly document this. (And if any changes to the code are necessary…)

from uri.

eode avatar eode commented on July 16, 2024

You are 100% correct -- I actually thought I didn't submit this post, for just that reason.

The guy who did the spec seems pretty reasonable, and might go for file:foo/bar as relative, but I'm not sure. As of now according to the RFC, file:foo/bar is undefined, and relative file paths (as opposed to relative URL paths) aren't even discussed.

Informally, I've seen 'file:foo/bar' used, since it's conformant with the more general URI spec, and is otherwise an error in the file spec.

Edit: Sent him a message, comparing relative file:foo/bar.baz with his examples of proper usage that include file:c:/foo/bar.baz and file:/foo/bar.baz. ..we'll see if he has anything to say on the matter, if he notices the message :-).

from uri.

eode avatar eode commented on July 16, 2024

Until we have a weigh-in from him, and/or if we don't get one, this might be something that needs to either do:

  • Strict RFC (i think):
    • reject file:foo URIs, but accept file:c:/foo and file:/foo URIs
  • allow common usage
    • in ABNF: local-path = path-absolute / path-rootless instead of local-path = path-absolute.

..or, more simply, possibly just display rootless paths with no authority as file:rootless/path when making a str() of the URI.

from uri.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.