Skip to content

pathname2url() does not work if path starts with // #127217

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

For example:

>>> from urllib.request import pathname2url
>>> 'file:' + pathname2url('//foo/bar')
'file://foo/bar'

This is a file URI with path "/bar" and authority "foo". Non-empty authority other than "localhost" are usually rejected. The right URI for path "//foo/bar" is "file:////foo/bar" -- an URI with explicit empty authority.

Similar bug in urlunparse() and urlunsplit() was fixed in #67693.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions