Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urljoin() with no directory segments duplicates filename #67891

Closed
vadmium opened this issue Mar 19, 2015 · 7 comments
Closed

urljoin() with no directory segments duplicates filename #67891

vadmium opened this issue Mar 19, 2015 · 7 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@vadmium
Copy link
Member

vadmium commented Mar 19, 2015

BPO 23703
Nosy @orsenthil, @berkerpeksag, @vadmium, @demianbrecht
Files
  • issue23703.patch
  • issue23703_1.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2015-04-15.23:34:22.985>
    created_at = <Date 2015-03-19.07:09:16.092>
    labels = ['type-bug', 'library']
    title = 'urljoin() with no directory segments duplicates filename'
    updated_at = <Date 2015-04-15.23:34:22.984>
    user = 'https://github.com/vadmium'

    bugs.python.org fields:

    activity = <Date 2015-04-15.23:34:22.984>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-04-15.23:34:22.985>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2015-03-19.07:09:16.092>
    creator = 'martin.panter'
    dependencies = []
    files = ['38563', '38573']
    hgrepos = []
    issue_num = 23703
    keywords = ['patch']
    message_count = 7.0
    messages = ['238493', '238531', '238566', '238590', '241082', '241177', '241178']
    nosy_count = 5.0
    nosy_names = ['orsenthil', 'python-dev', 'berker.peksag', 'martin.panter', 'demian.brecht']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23703'
    versions = ['Python 3.5']

    @vadmium
    Copy link
    Member Author

    vadmium commented Mar 19, 2015

    This is a regression caused by revision 901e4e52b20a. Before (e.g. Python 3.4):

    >>> urljoin('a', 'b')
    'b'

    After:

    >>> urljoin('a', 'b')
    'b/b'

    This was identified in <https://bugs.python.org/issue18828#msg238363\> but is actually caused by the revision committed for bpo-22278.

    @vadmium vadmium added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 19, 2015
    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Mar 19, 2015

    Nice work tracking down the commit, thanks for that. I've attached a fix.

    @vadmium
    Copy link
    Member Author

    vadmium commented Mar 19, 2015

    Patch looks good enough.

    BTW I was thinking of something like this, which is a bit simpler, but I never tested it:

    segments[1:-1] = filter(None, segments[1:-1])

    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Mar 20, 2015

    Yep, that's a lot cleaner and tests pass. I've updated the patch with that line. Thanks.

    @vadmium
    Copy link
    Member Author

    vadmium commented Apr 15, 2015

    Any chance this regression can be fixed before the next release?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 15, 2015

    New changeset fc0e79387a3a by Berker Peksag in branch 'default':
    Issue bpo-23703: Fix a regression in urljoin() introduced in 901e4e52b20a.
    https://hg.python.org/cpython/rev/fc0e79387a3a

    @berkerpeksag
    Copy link
    Member

    Thanks!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants