Skip to content

fix: KeyError in get_sri_candidates when tag has no src/href#1462

Merged
7h3Rabbit merged 2 commits into
mainfrom
fix/sri-missing-src-same-origin
May 13, 2026
Merged

fix: KeyError in get_sri_candidates when tag has no src/href#1462
7h3Rabbit merged 2 commits into
mainfrom
fix/sri-missing-src-same-origin

Conversation

@marcusosterberg
Copy link
Copy Markdown
Contributor

Description

append_with_src only set 'src' and 'src-same-origin' keys when an href/src attribute was found. Tags without either attribute caused a KeyError on line 401 of get_sri_candidates.

Move the key assignments outside the conditional so both keys are always present. When no src is found, defaults to None and False.

Fixes #1461

append_with_src only set 'src' and 'src-same-origin' keys when an
href/src attribute was found. Tags without either attribute caused a
KeyError on line 401 of get_sri_candidates.

Move the key assignments outside the conditional so both keys are
always present. When no src is found, defaults to None and False.

Fixes #1461
@marcusosterberg marcusosterberg added the bug Something isn't working label May 13, 2026
@7h3Rabbit 7h3Rabbit merged commit 4355528 into main May 13, 2026
22 of 23 checks passed
@7h3Rabbit 7h3Rabbit deleted the fix/sri-missing-src-same-origin branch May 13, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: 'src-same-origin' in get_sri_candidates when tag has no src/href attribute

2 participants