Skip to content

🐛 fix(rewrite): check only text after() adds - #2497

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/rewrite-unclosed-script-comment
Nov 19, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/rewrite-unclosed-script-comment

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Fixes #2462

The check from #2450 scanned the whole content of an unclosed raw-text element after after() wrote into it, so a <!-- already in the input raised. It now checks only the written text, plus an end tag already in the input when the written text carries the > that completes it. Text that still ends the element early raises ValueError as before.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 19, 2026
@gaborbernat
gaborbernat force-pushed the fix/rewrite-unclosed-script-comment branch from 5d270b4 to 6e163c4 Compare November 19, 2026 07:04
@codspeed

codspeed Bot commented Nov 19, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 580 untouched benchmarks
⏩ 91 skipped benchmarks1


Comparing gaborbernat:fix/rewrite-unclosed-script-comment (6e163c4) with main (93809d9)

Open in CodSpeed

Footnotes

  1. 91 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

The check added in tox-dev#2450 scanned the whole content of an unclosed
raw-text element after() wrote into it, so a `<!--` already in the input
raised. Only the text from the write on is new: a match is checked where
it reaches into that text, and an end tag already in the input is checked
when the new text carries the `>` that completes it.

Fixes tox-dev#2462
@gaborbernat
gaborbernat force-pushed the fix/rewrite-unclosed-script-comment branch from 6e163c4 to 57085d2 Compare November 19, 2026 14:45
@gaborbernat
gaborbernat merged commit 8acecbb into tox-dev:main Nov 19, 2026
21 of 56 checks passed
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.

rewrite() raises for a <!-- in an unclosed script's source when after() adds text

1 participant