Skip to content

issue using urljoin from urllib.parse #136481

@sebastian-bearing

Description

@sebastian-bearing

Bug report

Bug description:

on joining a url where the base url not finish on "/" have the following impact

from urllib.parse import urljoin

print(urljoin('https://localhost/1/','2'))
# => https://localhost/1/2
print(urljoin('https://localhost/1/','/2'))
# => https://localhost/2
print(urljoin('https://localhost/1','/2'))
# =>https://localhost/2
print(urljoin('https://localhost/1','2'))
# => https://localhost/2

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions