mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-25 02:10:24 +00:00
pathnoquote chars adjusted
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1548 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
7adc342ec5
commit
bcffed778e
2 changed files with 7 additions and 6 deletions
|
|
@ -70,6 +70,10 @@ class TestUrl (unittest.TestCase):
|
|||
url = "http://example.com/?q=1%2a2"
|
||||
nurl = "http://example.com/?q=1%2A2"
|
||||
self.assertEqual(linkcheck.url.url_norm(url), nurl)
|
||||
# the no-quote chars
|
||||
url = "http://example.com/a*+-();b"
|
||||
nurl = url
|
||||
self.assertEqual(linkcheck.url.url_norm(url), nurl)
|
||||
|
||||
def test_norm_case_sensitivity (self):
|
||||
"""test url norm case sensitivity"""
|
||||
|
|
@ -243,8 +247,8 @@ class TestUrl (unittest.TestCase):
|
|||
url = 'nntp:'
|
||||
nurl = 'nntp:///'
|
||||
self.assertEqual(linkcheck.url.url_norm(url), nurl)
|
||||
url = "news:§$%&/´`(§%"
|
||||
nurl = 'news:%A7%24%25%26/%B4%60%28%A7%25'
|
||||
url = "news:§$%&/´`§%"
|
||||
nurl = 'news:%A7%24%25%26/%B4%60%A7%25'
|
||||
self.assertEqual(linkcheck.url.url_norm(url), nurl)
|
||||
# javascript url
|
||||
url = "javascript:loadthis()"
|
||||
|
|
|
|||
|
|
@ -194,10 +194,7 @@ def url_norm (url):
|
|||
# quote parts again
|
||||
urlparts[0] = urllib.quote(urlparts[0]) # scheme
|
||||
urlparts[1] = urllib.quote(urlparts[1], ':@') # host
|
||||
nopathquote = ';/=,~'
|
||||
# note: the list of chars not to quote is different for javascript urls
|
||||
if urlparts[0]=='javascript':
|
||||
nopathquote += '()+-'
|
||||
nopathquote = ';/=,~*-+()'
|
||||
urlparts[2] = urllib.quote(urlparts[2], nopathquote) # path
|
||||
res = urlparse.urlunsplit(urlparts)
|
||||
if url.endswith('#') and not urlparts[4]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue