Extra slash is added during path manipulations
jessebrennan opened this issue · comments
I'm not really sure how to articulate this other than the example I encountered when messing around in the console.
$ pip list | grep furl
furl 2.1.0
Python 3.6.8 (default, Aug 20 2019, 17:12:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import furl
>>> f = furl.furl('http://www.example.com')
>>> f.path = furl.Path(['a', 'b', 'c'])
>>> f
furl('http://www.example.com/a/b/c')
>>> p = f.path / 'd'
>>> p
Path('/a/b/c/d')
>>> f
furl('http://www.example.com//a/b/c')
>>> f.path
Path('//a/b/c')
I would not have expected this operation to change the value of f
.
Also running into this issue when setting the scheme
By attribute:
In [2]: from furl import furl
In [3]: u = furl('google.com')
In [4]: u
Out[4]: furl('google.com')
In [5]: u.scheme = 'https'
In [6]: u
Out[6]: furl('https:///google.com')
In [7]: str(u)
Out[7]: 'https:///google.com'
Or by set
:
In [2]: from furl import furl
In [3]: u = furl('google.com')
In [4]: u.set(scheme='https')
Out[4]: furl('https:///google.com')
In [5]: str(u)
Out[5]: 'https:///google.com'
@BradenM Thanks for weighing in! Your issue is, luckily, different than @jessebrennan's. It's this one: #85.
In short, without a database of TLDs, furl can't determine whether a string with period(s) in it is a path or a domain.
As for @jessebrennan's original issue, that's definitely a bug. I need some time to look into it. Or, if either of you have time, debugging and/or pull requests most welcome!
Core issue fixed with #130. Huge thank you to Matt Murch. 👏