mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix intersphinx fails if mapping URL contains any port
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -35,6 +35,7 @@ Bugs fixed
|
||||
* Sphinx crashes if self referenced toctree found
|
||||
* #2481: spelling mistake for mecab search splitter. Thanks to Naoki Sato.
|
||||
* #2309: Fix could not refer "indirect hyperlink targets" by ref-role
|
||||
* intersphinx fails if mapping URL contains any port
|
||||
|
||||
|
||||
Release 1.4.1 (released Apr 12, 2016)
|
||||
|
||||
@@ -150,7 +150,10 @@ def _strip_basic_auth(url):
|
||||
password = url_parts.password
|
||||
frags = list(url_parts)
|
||||
# swap out "user[:pass]@hostname" for "hostname"
|
||||
frags[1] = url_parts.hostname
|
||||
if url_parts.port:
|
||||
frags[1] = "%s:%s" % (url_parts.hostname, url_parts.port)
|
||||
else:
|
||||
frags[1] = url_parts.hostname
|
||||
url = parse.urlunsplit(frags)
|
||||
return (url, username, password)
|
||||
|
||||
|
||||
@@ -199,6 +199,16 @@ class TestStripBasicAuth(unittest.TestCase):
|
||||
self.assertEqual(None, actual_username)
|
||||
self.assertEqual(None, actual_password)
|
||||
|
||||
def test_having_port(self):
|
||||
"""basic auth creds correctly stripped from URL containing creds even if URL
|
||||
contains port"""
|
||||
url = 'https://user:12345@domain.com:8080/project/objects.inv'
|
||||
expected = 'https://domain.com:8080/project/objects.inv'
|
||||
actual_url, actual_username, actual_password = _strip_basic_auth(url)
|
||||
self.assertEqual(expected, actual_url)
|
||||
self.assertEqual('user', actual_username)
|
||||
self.assertEqual('12345', actual_password)
|
||||
|
||||
|
||||
@mock.patch('six.moves.urllib.request.HTTPBasicAuthHandler')
|
||||
@mock.patch('six.moves.urllib.request.HTTPPasswordMgrWithDefaultRealm')
|
||||
|
||||
Reference in New Issue
Block a user