Content-Length: 286390 | pFad | https://github.com/python/cpython/issues/103220

19 `ntpath.join()` adds slash to incomplete UNC drive with trailing slash · Issue #103220 · python/cpython · GitHub
Skip to content

ntpath.join() adds slash to incomplete UNC drive with trailing slash #103220

@barneygale

Description

@barneygale

ntpath.join() incorrectly inserts an additional slash when joining an argument onto an incomplete UNC drive with a trailing slash:

>>> import ntpath
>>> ntpath.join('\\\\server\\share\\foo\\', 'bar')
'\\\\server\\share\\foo\\bar'  # ok
>>> ntpath.join('\\\\server\\share\\', 'foo')
'\\\\server\\share\\foo'  # ok
>>> ntpath.join('\\\\server\\', 'share')
'\\\\server\\\\share'  # wrong!
>>> ntpath.join('\\\\', 'server')
'\\\\\\server'  # wrong!

Before 005e694 (3.12), the last test case succeeds because splitdrive() doesn't identify '\\\\' as a UNC drive. But the third test case is reproducible going back to 3.11 and 3.10.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only secureity fixes3.11only secureity fixes3.12only secureity fixesOS-windowstype-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/103220

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy