This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urljoin() with no directory segments duplicates filename
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, demian.brecht, martin.panter, orsenthil, python-dev
Priority: normal Keywords: patch

Created on 2015-03-19 07:09 by martin.panter, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue23703.patch demian.brecht, 2015-03-19 15:05 review
issue23703_1.patch demian.brecht, 2015-03-20 00:13 review
Messages (7)
msg238493 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-03-19 07:09
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 Issue 22278.
msg238531 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-03-19 15:05
Nice work tracking down the commit, thanks for that. I've attached a fix.
msg238566 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-03-19 21:57
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])
msg238590 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-03-20 00:13
Yep, that's a lot cleaner and tests pass. I've updated the patch with that line. Thanks.
msg241082 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-04-15 05:41
Any chance this regression can be fixed before the next release?
msg241177 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-15 23:31
New changeset fc0e79387a3a by Berker Peksag in branch 'default':
Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a.
https://hg.python.org/cpython/rev/fc0e79387a3a
msg241178 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-04-15 23:34
Thanks!
History
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67891
2015-04-15 23:34:22berker.peksagsetstatus: open -> closed
resolution: fixed
messages: + msg241178

stage: patch review -> resolved
2015-04-15 23:31:37python-devsetnosy: + python-dev
messages: + msg241177
2015-04-15 05:41:01martin.pantersetmessages: + msg241082
2015-03-24 14:16:13berker.peksagsetnosy: + berker.peksag
2015-03-20 00:13:42demian.brechtsetfiles: + issue23703_1.patch

messages: + msg238590
2015-03-19 21:57:04martin.pantersetmessages: + msg238566
2015-03-19 15:05:18demian.brechtsetfiles: + issue23703.patch
keywords: + patch
messages: + msg238531

stage: patch review
2015-03-19 08:15:58berker.peksagsetnosy: + orsenthil
2015-03-19 07:09:16martin.pantercreate