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

Another regression in URL join behavior #862

Closed
1 task done
gmacon opened this issue Apr 27, 2023 · 3 comments · Fixed by #866
Closed
1 task done

Another regression in URL join behavior #862

gmacon opened this issue Apr 27, 2023 · 3 comments · Fixed by #866
Labels

Comments

@gmacon
Copy link
Contributor

gmacon commented Apr 27, 2023

Describe the bug

Joining a path onto an existing URL no longer preserves a trailing slash in the last component.

To Reproduce

#!/usr/bin/env python3

from yarl import URL

single = URL("http://example.com/dir/")
combined = URL("http://example.com") / "dir/"
print(f"single: {single}")
print(f"combined: {combined}")
assert str(single) == str(combined)

Expected behavior

The trailing slash should be preserved.

Logs/tracebacks

$ ./regress.py
single: http://example.com/dir/
combined: http://example.com/dir
Traceback (most recent call last):
  File "./regress.py", line 9, in <module>
    assert str(single) == str(combined)
AssertionError

Python Version

$ python --version
Python 3.8.13

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: andrew.svetlov@gmail.com
License: Apache 2
Location: /Users/gmacon3/code/github.com/aio-libs/yarl/venv/lib/python3.8/site-packages
Requires:
Required-by: yarl

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.9.2
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache-2.0
Location: /home/vagrant/venv/lib/python3.8/site-packages
Requires: idna, multidict
Required-by: aiohttp, apiary-client, apiary-messages

OS

RHEL 7

Additional context

I bisected this to 2dac93f, which I note is the same commit that caused #854 reporting a different regression related to joined URLs.

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@gmacon gmacon added the bug label Apr 27, 2023
@dann-romm
Copy link

in addition,

MAIN_URL = 'example.com'

SECOND_URL = (MAIN_URL / 'some_path/').with_query(
    'some_variable=1'
)

SECOND_URL
expected example.com/some_path/?some_variable=1
got example.com/some_path?some_variable=1

gmacon added a commit to gmacon/yarl that referenced this issue May 3, 2023
gmacon added a commit to gmacon/yarl that referenced this issue Jun 7, 2023
mjpieters pushed a commit that referenced this issue Jun 7, 2023
@dimaqq
Copy link

dimaqq commented Jun 22, 2023

Release, please? 🙏🏻

@DanielNoord
Copy link

Gentle ping on this release. This regression breaks both 1.9.0 and 1.9.1. We'd like not to pin yarl as it used in so many other dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants