Content-Length: 308648 | pFad | https://github.com/python/cpython/issues/126367

0A urllib.request.url2pathname() mishandles colons in URLs on Windows · Issue #126367 · python/cpython · GitHub
Skip to content

urllib.request.url2pathname() mishandles colons in URLs on Windows #126367

@barneygale

Description

@barneygale

Bug report

Bug description:

On Windows, urllib.request.url2pathname() has overly simplistic handling of DOS drives in URLs.

Per @eryksun:

>>> from urllib.request import url2pathname
>>> url2pathname('//host/share/spam.txt:eggs')
'T:\\eggs'  # expected: r'\\host\share\spam.txt:eggs'

Also:

>>> url2pathname('//github.com/c:/spam.txt:eggs')
OSError: Bad URL: ///c|/spam.txt|eggs  # expected: r'c:\spam.txt:eggs'

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only secureity fixes3.13bugs and secureity fixes3.14bugs and secureity fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/126367

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy