-
-
Notifications
You must be signed in to change notification settings - Fork 32.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
Conversation
According to RFC3986 5.2.2., target fragment is always reference fragment. https://bugs.python.org/issue39799
Codecov Report
@@ Coverage Diff @@
## master #18710 +/- ##
=========================================
Coverage 82.13% 82.13%
=========================================
Files 1956 1955 -1
Lines 589974 584599 -5375
Branches 44484 44483 -1
=========================================
- Hits 484572 480160 -4412
+ Misses 95750 94791 -959
+ Partials 9652 9648 -4
Continue to review full report at Codecov.
|
Lib/test/test_urlparse.py
Outdated
@@ -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') |
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
?
Lib/test/test_urlparse.py
Outdated
@@ -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') |
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 add a test for self.checkJoin('http://a/b/#f', 'g', 'http://a/b/g')
?
@@ -0,0 +1,3 @@ | |||
Fix ``urllib.parse.urljoin`` |
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 mention that this is in order to conform with RFC 3986?
@epicfaace I edited accordingly. |
According to RFC3986 5.2.2.,
target fragment is always reference fragment.
https://bugs.python.org/issue39799
https://bugs.python.org/issue39799