Fix critical exception when parsing a URL with a ]

e.g.:
<a href="http://localhost]">square</a>

Causes urllib to raise a ValueError:
  File "/usr/lib/python3.8/site-packages/linkcheck/url.py", line 315, in url_norm
    line: urlparts = list(urllib.parse.urlsplit(url))
    locals:
      urlparts = <not found>
      list = <builtin> <class 'list'>
      urllib = <global> <module 'urllib' from '/usr/lib/python3.8/urllib/__init__.py'>
      urllib.parse = <global> <module 'urllib.parse' from '/usr/lib/python3.8/urllib/parse.py'>
      urllib.parse.urlsplit = <global> <function urlsplit at 0x7f950e699e50>
      url = <local> 'http://localhost]', len = 17
  File "/usr/lib/python3.8/urllib/parse.py", line 440, in urlsplit
    line: raise ValueError("Invalid IPv6 URL")
    locals:
      ValueError = <builtin> <class 'ValueError'>
This commit is contained in:
Chris Mayo 2020-08-08 16:47:31 +01:00
parent a977e4d712
commit d5690203fc

View file

@ -27,6 +27,7 @@ from dns.exception import DNSException
# Catch these exception on syntax checks.
ExcSyntaxList = [
LinkCheckerError,
ValueError,
]
# Catch these exceptions on content and connect checks. All other