-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
bpo-39799: Never return base's fragment from urllib.parse.urljoin #18710
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e4b230b
bpo-39799: Never return base's fragment from urllib.parse.urljoin
openandclose 9cfe7c0
📜🤖 Added by blurb_it.
blurb-it[bot] 40338d6
Add 3 edits suggested from @epicfaace
openandclose 79f5a02
Merge branch 'main' into urljoin_no_base_fragment
serhiy-storchaka 419fbe5
Fix new code and tests.
serhiy-storchaka 744cab6
Remove duplicate tests.
serhiy-storchaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -265,7 +265,6 @@ def test_RFC1808(self): | |
| self.checkJoin(RFC1808_BASE, '../../g', 'http://a/g') | ||
|
|
||
| # "abnormal" cases from RFC 1808: | ||
| self.checkJoin(RFC1808_BASE, '', 'http://a/b/c/d;p?q#f') | ||
| self.checkJoin(RFC1808_BASE, 'g.', 'http://a/b/c/g.') | ||
| self.checkJoin(RFC1808_BASE, '.g', 'http://a/b/c/.g') | ||
| self.checkJoin(RFC1808_BASE, 'g..', 'http://a/b/c/g..') | ||
|
|
@@ -281,6 +280,7 @@ def test_RFC1808(self): | |
| #self.checkJoin(RFC1808_BASE, 'http:', 'http:') | ||
|
|
||
| # XXX: The following tests are no longer compatible with RFC3986 | ||
| # self.checkJoin(RFC1808_BASE, '', 'http://a/b/c/d;p?q#f') | ||
| # self.checkJoin(RFC1808_BASE, '../../../g', 'http://a/../g') | ||
| # self.checkJoin(RFC1808_BASE, '../../../../g', 'http://a/../../g') | ||
| # self.checkJoin(RFC1808_BASE, '/./g', 'http://a/./g') | ||
|
|
@@ -449,6 +449,9 @@ def test_urljoins(self): | |
| # issue 23703: don't duplicate filename | ||
| self.checkJoin('a', 'b', 'b') | ||
|
|
||
| # issue 39799: no base fragment (not compatible with RFC1808) | ||
| self.checkJoin('http://a/b#f', '', 'http://a/b') | ||
|
||
|
|
||
| def test_RFC2732(self): | ||
| str_cases = [ | ||
| ('http://Test.python.org:5432/foo/', 'test.python.org', 5432), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Library/2020-02-29-20-44-36.bpo-39799.qTHOaP.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Fix ``urllib.parse.urljoin`` | ||
|
||
| when ``base`` has fragment and ``url`` is blank | ||
| (Returns ``base`` without fragment, not ``base`` entirely). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this test to be under
test_RFC3986?