Repository navigation
Conversation
3bb693a to
9dcea1e
Compare
9dcea1e to
ad5f612
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #418 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 2990 2998 +8
Branches 457 459 +2
=========================================
+ Hits 2990 2998 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
benoit74
left a comment
There was a problem hiding this comment.
Should we be a bit more defensive for bad HTML? Something like <html><head><head></head></head>... would still include the head insert twice AFAIK (at least it is not tested)
94b3ebe to
437ea98
Compare
|
@benoit74 Good catch — the guard was only set on |
benoit74
left a comment
There was a problem hiding this comment.
LGTM, forgot to ask about a CHANGELOG entry. Thank you
HtmlRewriter now emits pre_head_insert / post_head_insert only for the first <head> of the document. The guard is set when that opening tag is seen, so malformed HTML with repeated or nested <head> tags cannot emit the pre-insert twice, and a stray </head> cannot emit the post-insert on its own. Pages that embed a second HTML document in their body no longer run the inline head insert script twice. Fixes openzim#417
437ea98 to
428ea70
Compare
|
Added the changelog entry too: |
Fix duplicate head insert on pages embedding a nested HTML document
HtmlRewriter now emits pre_head_insert / post_head_insert only for the first
of the document. A head_insert_done guard prevents the inserts from being applied again to a nested document's , which previously caused the inline script to run twice and throw a SyntaxError.Fixes #417