Title: urllib.request.url2pathname() mishandles non-empty authority sections on POSIX · Issue #126838 · python/cpython · GitHub
Open Graph Title: urllib.request.url2pathname() mishandles non-empty authority sections on POSIX · Issue #126838 · python/cpython
X Title: urllib.request.url2pathname() mishandles non-empty authority sections on POSIX · Issue #126838 · python/cpython
Description: Bug report Bug description: URLs supplied to urllib.request.url2pathname() may include a non-empty authority (netloc), such as a hostname. On Windows, these are correctly decoded (mostly): >>> url2pathname('//localhost/c:/foo.txt') 'C:\\...
Open Graph Description: Bug report Bug description: URLs supplied to urllib.request.url2pathname() may include a non-empty authority (netloc), such as a hostname. On Windows, these are correctly decoded (mostly): >>> url2...
X Description: Bug report Bug description: URLs supplied to urllib.request.url2pathname() may include a non-empty authority (netloc), such as a hostname. On Windows, these are correctly decoded (mostly): >>...
Opengraph URL: https://github.com/python/cpython/issues/126838
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"urllib.request.url2pathname() mishandles non-empty authority sections on POSIX","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nURLs supplied to `urllib.request.url2pathname()` may include a non-empty authority (netloc), such as a hostname.\r\n\r\nOn Windows, these are correctly decoded ([mostly](https://github.com/python/cpython/issues/126367)):\r\n\r\n```python\r\n>>> url2pathname('//localhost/c:/foo.txt')\r\n'C:\\\\foo.txt' # OK\r\n>>> url2pathname('//server/share')\r\n'\\\\\\\\server\\\\share' # OK\r\n```\r\n\r\nBut on POSIX, any non-empty authority except `localhost` is preserved in the path:\r\n\r\n```python\r\n>>> url2pathname('//myhostname/etc/hosts')\r\n'//myhostname/etc/hosts' # expected '/etc/hosts'\r\n>>> url2pathname('//server/share')\r\n'//server/share' # expected URLError ('server' is not local)\r\n```\r\n\r\nPer [RFC 8089](https://datatracker.ietf.org/doc/html/rfc8089#section-2) this isn't correct.\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\r\n\r\n\u003c!-- gh-linked-prs -->\r\n### Linked PRs\r\n* gh-126844\r\n\u003c!-- /gh-linked-prs -->\r\n","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2024-11-14T20:35:34Z","url":"https://github.com/python/cpython/issues/126838"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f93c23fc-727d-1658-9568-01e7cd32d5eb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE18:39FDE1:D796E9:10E7367:6B022F5B |
| html-safe-nonce | bb0bff8384dc2d90fbc7439f9730dd08caecc033a8c7505b732659c5748328c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTE4OjM5RkRFMTpENzk2RTk6MTBFNzM2Nzo2QjAyMkY1QiIsInZpc2l0b3JfaWQiOiIyODkwNzcxMDY3OTk4MTg3MzU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8e745c05929876165ac7b3afa07a010af014ab0deab7d5673ce2fcef5e7a2cb0 |
| hovercard-subject-tag | issue:2660004662 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/126838/issue_layout |
| twitter:image | https://opengraph.githubassets.com/08ab086c10c107db8357709c2a8a776dd3e03116baf488d54adaab3322958831/python/cpython/issues/126838 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/08ab086c10c107db8357709c2a8a776dd3e03116baf488d54adaab3322958831/python/cpython/issues/126838 |
| og:image:alt | Bug report Bug description: URLs supplied to urllib.request.url2pathname() may include a non-empty authority (netloc), such as a hostname. On Windows, these are correctly decoded (mostly): >>> url2... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | barneygale |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width