-
-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Labels
Description
Please confirm the following
- I agree to follow the aio-libs Code of Conduct
- I have checked the current issues for duplicates.
- I understand this is open source software provided for free and that I might not receive a timely response.
- I am positive I am NOT reporting a (potential) security
vulnerability, to the best of my knowledge. (These must be shared by
submitting this report form instead, if
any hesitation exists.)
- I am willing to submit a pull request with reporoducers as xfailing test cases or even entire fix. (Assign this issue to me.)
Describe the bug
Calling with_suffix always re-encode the entire name. That's because with_suffix calls with_name under the hood, which always auto encodes
from the method's description:
suffix is encoded if needed
Lines 1350 to 1354 in 07c1b4f
| """Return a new URL with suffix (file extension of name) replaced. | |
| Query and fragment parts are cleaned up. | |
| suffix is encoded if needed. |
To Reproduce
from yarl import URL
url = URL("https://domain.com/video file.mp4")
print (url) # https://domain.com/video%20file.mp4
print (url.with_suffix(".avi")) # https://domain.com/video%2520file.aviExpected behavior
Only the suffix should be encoded (if needed) instead of the entire name.
Therefore, the expected result would be https://domain.com/video%20file.avi instead of https://domain.com/video%2520file.avi
Logs/tracebacks
NAPython Version
$ python --version
Python 3.13.2multidict Version
$ python -m pip show multidict
Version: 6.1.0propcache Version
$ python -m pip show propcache
Version: 0.2.1yarl Version
$ python -m pip show yarl
Version: 1.18.3OS
Windows 10
Additional context
No response
Reactions are currently unavailable