mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-22 07:04:44 +00:00
Fix blacklist updating
A second run creates an additional entry in blacklist rather than upating the original: 1 '"(\'http://localhost/broken.html\', \'http://localhost/nosuchlink.html\')"' 1 "('http://localhost/broken.html', 'http://localhost/nosuchlink.html')" Broken since at least 9.3: 1 "(u'http://localhost/broken.html', u'http://localhost/nosuchlink.html')" 1 u'"(u\'http://localhost/broken.html\', u\'http://localhost/nosuchlink.html\')"' If such an entry is found LinkChecker will now halt. Either remove the entry or the whole file.
This commit is contained in:
parent
a977e4d712
commit
7d950cf848
1 changed files with 9 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import os
|
|||
|
||||
from linkcheck.configuration import get_user_data
|
||||
from . import _Logger
|
||||
from .. import log, LOG_CHECK
|
||||
|
||||
|
||||
class BlacklistLogger(_Logger):
|
||||
|
|
@ -83,6 +84,14 @@ class BlacklistLogger(_Logger):
|
|||
if line.startswith('#') or not line:
|
||||
continue
|
||||
value, key = line.split(None, 1)
|
||||
key = key.strip('"')
|
||||
if not key.startswith('('):
|
||||
log.critical(
|
||||
LOG_CHECK,
|
||||
_("invalid line starting with '%(linestart)s' in %(blacklist)s")
|
||||
% {"linestart": line[:12], "blacklist": self.filename}
|
||||
)
|
||||
raise SystemExit(2)
|
||||
self.blacklist[key] = int(value)
|
||||
|
||||
def write_blacklist(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue