urllib.request.pathname2url() raises on NTFS alternate data stream · Issue #126601 · python/cpython (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Bug report
Bug description:
On Windows, urllib.request.pathname2url()
raises OSError
when given a path with a colon in any position other than the second character. This excludes paths with NTFS alternate data streams, which are valid in other path-processing functions (e.g. in os.path
and pathlib
):
from urllib.request import pathname2url pathname2url(r'C:\foo:bar') OSError: Bad path: C:/foo:bar # expected: ///C:/foo%3Abar pathname2url(r'foo:bar') OSError: Bad path: foo:bar # expected: foo%3Abar
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows