mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-17 06:20:27 +00:00
Fix critical exception if srcset value ends with a comma
Log a debug message as this is a minor syntax problem, won't stop LinkChecker parsing strings up to the comma.
This commit is contained in:
parent
a977e4d712
commit
7ba4053710
1 changed files with 11 additions and 2 deletions
|
|
@ -201,8 +201,17 @@ class LinkFinder:
|
|||
self.found_url(url, name, base, lineno, column)
|
||||
elif attr == 'srcset':
|
||||
for img_candidate in value.split(','):
|
||||
url = img_candidate.split()[0]
|
||||
self.found_url(url, name, base, lineno, column)
|
||||
try:
|
||||
url = img_candidate.split()[0]
|
||||
except IndexError:
|
||||
log.debug(
|
||||
LOG_CHECK,
|
||||
_("trailing comma in line: "
|
||||
"%(line)s srcset attribute: %(value)s")
|
||||
% {"line": lineno, "value": value}
|
||||
)
|
||||
else:
|
||||
self.found_url(url, name, base, lineno, column)
|
||||
else:
|
||||
self.found_url(value, name, base, lineno, column)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue