mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Only attempt to get rel attribute from link elements
This commit is contained in:
parent
643364a655
commit
926932411d
1 changed files with 2 additions and 2 deletions
|
|
@ -159,8 +159,8 @@ class LinkFinder:
|
|||
base = self.base_ref
|
||||
# note: value can be None
|
||||
value = attrs.get(attr)
|
||||
rel = attrs.get('rel', '').lower()
|
||||
if tag == 'link' and ('dns-prefetch' in rel or 'preconnect' in rel):
|
||||
if tag == 'link' and (rel := attrs.get('rel', '').lower()) \
|
||||
and ('dns-prefetch' in rel or 'preconnect' in rel):
|
||||
if ':' in value:
|
||||
value = value.split(':', 1)[1]
|
||||
value = 'dns:' + value.rstrip('/')
|
||||
|
|
|
|||
Loading…
Reference in a new issue