-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
urllib.request.urlopen('file:...').url incorrect value #127090
Comments
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Nov 21, 2024
The original `file:` URL that was passed to `urlopen()` is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute *always* reflects the original `file:`, `data:` or `ftp:` URL now.
Hi @barneygale I can work upon this issue ...Can you provide some more details about the issue. |
I'm sorry @kanishka-coder0809, I'm afraid I already opened a PR for this issue shortly before your comment: #127091 |
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Nov 22, 2024
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Nov 25, 2024
barneygale
added a commit
that referenced
this issue
Dec 7, 2024
…e:` URIs (#127091) The canonical `file:` URL (as generated by `pathname2url()`) is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute reflects the resolved URL for both `file:` or `http[s]:` URLs now.
Fixed in 3.14, but not worth backporting IMO. Closing... |
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Jan 8, 2025
…d `file:` URIs (python#127091) The canonical `file:` URL (as generated by `pathname2url()`) is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute reflects the resolved URL for both `file:` or `http[s]:` URLs now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug description:
When a
file:
URL is given tourllib.request.urlopen()
, it returns anaddinfourl
object. This object'surl
attribute (and its deprecatedgeturl()
method) usually return incorrect results. For example:The code always prepends
file://
, but this might be too many slashes or too few depending on the path's drive and root.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
urllib.response.addinfourl.url
value for openedfile:
URIs #127091The text was updated successfully, but these errors were encountered: