yarl icon indicating copy to clipboard operation
yarl copied to clipboard

Regression: Trailing slash for yarl.URL ("http://localhost") / "path" / "" is dropped in 1.9.4

Open alex-kowalczyk opened this issue 5 months ago • 3 comments

Describe the bug

yarl 1.8.2 allowed to construct URLs with trailing slashes like that:

>>> str(yarl.URL ("http://localhost") / "path" / "") 
'http://localhost/path/'

yarl 1.9.4 drops the slash from that path. Possibly related to https://github.com/aio-libs/yarl/issues/862 :

>>> str(yarl.URL ("http://localhost") / "path" / "") 
'http://localhost/path'

To Reproduce

Try 1.8.2 vs 1.9.4 with the code above.

Expected behavior

Preserve the slash

Logs/tracebacks

-

Python Version

Python 3.11.6

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 6.0.4
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Requires: 
Required-by: aiohttp, yarl

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.9.4
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache-2.0
Location: /home/alex/.local/share/virtualenvs/widget.backend-6HfWXuQ_/lib/python3.11/site-packages
Requires: idna, multidict
Required-by: aiohttp

OS

Ubuntu 23.10

Additional context

No response

Code of Conduct

  • [X] I agree to follow the aio-libs Code of Conduct

alex-kowalczyk avatar Jan 22 '24 15:01 alex-kowalczyk