gruns / gruns/furl

Rootless file URIs do not round trip

Open
#115 3 comments 0 reactions 0 assignees View on GitHub
Kind/Enhancement
Dominant language
Python
Stars
2.8k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

[RFC-3986](https://tools.ietf.org/html/rfc3986#section-3.3) talks about rootless path URIs.
I interpret this to mean that a URI of file:relative/path.ext is a perfectly reasonably URI indicating a relative path. Unfortunately this does not round trip:

```python
>>> from furl import furl
>>> f = furl("file:relative/path.ext")
>>> f
furl('file:///relative/path.ext')
>>> f.path
Path('relative/path.ext')
>>> f2 = furl("file:///relative/path.ext")
>>> f2.path
Path('/relative/path.ext')
>>> f2
furl('file:///relative/path.ext')
```
The URI is turned from a relative path to an absolute path. In the first instance internally the object knows that it is a relative path but the stringification of the URL turns it into an absolute path.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.