Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

urllib.request.pathname2url() mishandles UNC paths #126205

Copy link
Copy link
Closed
@barneygale

Description

@barneygale
Issue body actions

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.pathname2url(r'\\server\share')
'////server/share'

Furthermore, when given an extended UNC path like \\?\unc\server\share, pathname2url() incorrectly generates a URI that begins with only one slash:

>>> urllib.request.pathname2url(r'\\?\unc\server\share')
'/server/share'

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.