mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-17 04:41:01 +00:00
javascript urls are less quoted for compatibility
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1532 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
3d678d6d3b
commit
09adff7cf6
2 changed files with 9 additions and 1 deletions
|
|
@ -246,6 +246,10 @@ class TestUrl (unittest.TestCase):
|
|||
url = "news:§$%&/´`(§%"
|
||||
nurl = 'news:%A7%24%25%26/%B4%60%28%A7%25'
|
||||
self.assertEqual(linkcheck.url.url_norm(url), nurl)
|
||||
# javascript url
|
||||
url = "javascript:loadthis()"
|
||||
nurl = url
|
||||
self.assertEqual(linkcheck.url.url_norm(url), nurl)
|
||||
|
||||
def test_norm_with_auth (self):
|
||||
"""test norming of urls with authentication tokens"""
|
||||
|
|
|
|||
|
|
@ -192,7 +192,11 @@ def url_norm (url):
|
|||
# quote parts again
|
||||
urlparts[0] = urllib.quote(urlparts[0]) # scheme
|
||||
urlparts[1] = urllib.quote(urlparts[1], ':@') # host
|
||||
urlparts[2] = urllib.quote(urlparts[2], '/=,~') # path
|
||||
nopathquote = ';/=,~'
|
||||
# note: the list of chars not to quote is different for javascript urls
|
||||
if urlparts[0]=='javascript':
|
||||
nopathquote += '()+-'
|
||||
urlparts[2] = urllib.quote(urlparts[2], nopathquote) # path
|
||||
res = urlparse.urlunsplit(urlparts)
|
||||
if url.endswith('#') and not urlparts[4]:
|
||||
# append trailing empty fragment
|
||||
|
|
|
|||
Loading…
Reference in a new issue