mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Work around Python 2.6+ urljoin bug.
This commit is contained in:
parent
c3b8ff00b3
commit
8a074aeea9
3 changed files with 15 additions and 0 deletions
|
|
@ -9,6 +9,9 @@ Fixes:
|
|||
Closes: SF bug #3035754
|
||||
- file: Prevent truncation of UNC paths on Windows systems.
|
||||
Closes: SF bug #3017391
|
||||
- url: Work around a Python bug cutting off characters when joining an
|
||||
URL that starts with semicolon.
|
||||
Closes: SF bug #3056136
|
||||
|
||||
Changes:
|
||||
- checking: Caches are now size-restricted to limit the memory
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ def urljoin (parent, url, scheme):
|
|||
"""
|
||||
if url.startswith(scheme+":"):
|
||||
return url
|
||||
# work around a Python 2.6/3.1 bug cutting off characters when the URL
|
||||
# begins with semicolon
|
||||
if url.startswith(';'):
|
||||
url = "./%s" % url
|
||||
return urlparse.urljoin(parent, url)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import unittest
|
|||
import linkcheck.configuration
|
||||
import linkcheck.director
|
||||
import linkcheck.checker.httpurl
|
||||
import linkcheck.checker.urlbase
|
||||
|
||||
|
||||
def get_test_aggregate ():
|
||||
|
|
@ -47,3 +48,10 @@ class TestUrlBuild (unittest.TestCase):
|
|||
aggregate, parent_url=parent_url)
|
||||
o.build_url()
|
||||
self.assertEqual(o.url, 'http://')
|
||||
|
||||
def test_urljoin (self):
|
||||
parent_url = "http://localhost:8001/test"
|
||||
base_url = ";param=value"
|
||||
scheme = 'http'
|
||||
res = linkcheck.checker.urlbase.urljoin(parent_url, base_url, scheme)
|
||||
self.assertEqual(res, 'http://localhost:8001/;param=value')
|
||||
|
|
|
|||
Loading…
Reference in a new issue