Describe the bug
The url that I pass into the .get() function is not being handled correctly when there are parentheses in the path. This is causing issues when trying to download documents that use the standard naming convention for copies:
my_document (1).pdf
The expected url for that document download would look something like:
https://python.org/my_document%20%281%29.pdf
with the following encodings:
- space
-> %20
- left parenthesis
( -> %28
- right parenthesis
) -> %29
Instead it is being decoded at some point and ends up looking like this:
https://www.python.org/document%20(1).pdf
To Reproduce
async with aiohttp.ClientSession() as session:
async with session.get('http://python.org/my_document%20%281%29') as response:
print(response.request_info)
> RequestInfo(url=URL('https://www.python.org/my_document%20(1).pdf'), method='GET', headers=<CIMultiDictProxy('Host': 'www.python.org', ...)>, real_url=URL('https://www.python.org/document%20(1).pdf'))
Expected behavior
async with aiohttp.ClientSession() as session:
async with session.get('http://python.org/my_document%20%281%29') as response:
print(response.request_info)
> RequestInfo(url=URL('https://www.python.org/my_document%20%281%29.pdf'), method='GET', headers=<CIMultiDictProxy('Host': 'www.python.org', ...)>, real_url=URL('https://www.python.org/document%20%281%29.pdf'))
Logs/tracebacks
Python Version
$ python --version
Python 3.11.1
aiohttp Version
$ python -m pip show aiohttp
Name: aiohttp
Version: 3.8.4
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author:
Author-email:
License: Apache 2
Location: [redacted}
Requires: aiosignal, async-timeout, attrs, charset-normalizer, frozenlist, multidict, yarl
Required-by: aiobotocore, aioresponses
multidict Version
$ python -m pip show multidict
Name: multidict
Version: 6.0.2
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: [redacted]
Requires:
Required-by: aiohttp, yarl
yarl Version
$ python -m pip show yarl
Name: yarl
Version: 1.8.1
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: [redacted]
Requires: idna, multidict
Required-by: aio-pika, aiohttp, aiormq
OS
macOS
Related component
Client
Additional context
No response
Code of Conduct
Describe the bug
The url that I pass into the
.get()function is not being handled correctly when there are parentheses in the path. This is causing issues when trying to download documents that use the standard naming convention for copies:my_document (1).pdfThe expected url for that document download would look something like:
https://python.org/my_document%20%281%29.pdfwith the following encodings:
->%20(->%28)->%29Instead it is being decoded at some point and ends up looking like this:
https://www.python.org/document%20(1).pdfTo Reproduce
Expected behavior
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
macOS
Related component
Client
Additional context
No response
Code of Conduct