Title: urllib.request.pathname2url() mishandles UNC paths · Issue #126205 · python/cpython · GitHub
Open Graph Title: urllib.request.pathname2url() mishandles UNC paths · Issue #126205 · python/cpython
X Title: urllib.request.pathname2url() mishandles UNC paths · Issue #126205 · python/cpython
Description: Bug report Bug description: When given a Windows UNC path, urllib.request.pathname2url() incorrectly generates a URI that begins with four slashes. The correct number is two, see ref1, ref2. >>> import urllib.request >>> urllib.request.p...
Open Graph Description: Bug report Bug description: When given a Windows UNC path, urllib.request.pathname2url() incorrectly generates a URI that begins with four slashes. The correct number is two, see ref1, ref2. >>> im...
X Description: Bug report Bug description: When given a Windows UNC path, urllib.request.pathname2url() incorrectly generates a URI that begins with four slashes. The correct number is two, see ref1, ref2. >&g...
Opengraph URL: https://github.com/python/cpython/issues/126205
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"urllib.request.pathname2url() mishandles UNC paths","articleBody":"# Bug report\n\n### Bug description:\n\nWhen given a Windows UNC path, `urllib.request.pathname2url()` incorrectly generates a URI that begins with four slashes. The correct number is two, see [ref1](https://learn.microsoft.com/en-us/archive/blogs/ie/file-uris-in-windows), [ref2](https://datatracker.ietf.org/doc/html/rfc8089#appendix-E.3.1).\n\n```python\n>>> import urllib.request\n>>> urllib.request.pathname2url(r'\\\\server\\share')\n'////server/share'\n```\n\nFurthermore, when given an extended UNC path like `\\\\?\\unc\\server\\share`, `pathname2url()` incorrectly generates a URI that begins with only one slash:\n\n```python\n>>> urllib.request.pathname2url(r'\\\\?\\unc\\server\\share')\n'/server/share'\n```\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nWindows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-126208\n* gh-126248\n* gh-126249\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2024-10-30T20:39:30Z","url":"https://github.com/python/cpython/issues/126205"}
| 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:d6dcaa01-e027-dc34-1604-7112e72d607c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DB22:3F8AB1:49CFE40:5D8463B:6B023346 |
| html-safe-nonce | 3de88f357ff31bcb629b54157a2e7e5c1e221e5febc41d7941e451e83365dc75 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjIyOjNGOEFCMTo0OUNGRTQwOjVEODQ2M0I6NkIwMjMzNDYiLCJ2aXNpdG9yX2lkIjoiMzg5NDgzNDk4OTAxNTExODY2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c5628a55cb251916f495bef9a0a0f2699a620dfb78d96ff2e0b61858e11a989a |
| hovercard-subject-tag | issue:2625291535 |
| 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/126205/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0a0d8c9c4f6c7d17e2b4630a81583aaa1891b5c6bb2dd549fdc95fcc292c779f/python/cpython/issues/126205 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0a0d8c9c4f6c7d17e2b4630a81583aaa1891b5c6bb2dd549fdc95fcc292c779f/python/cpython/issues/126205 |
| og:image:alt | Bug report Bug description: When given a Windows UNC path, urllib.request.pathname2url() incorrectly generates a URI that begins with four slashes. The correct number is two, see ref1, ref2. >>> im... |
| 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