Repository navigation
fix(server): EPUB text skips hidden map groups that also set a transform - #48478
StiensWout wants to merge 3 commits into
Conversation
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Inline styles with parentheses, such as a transform, were treated as unreadable, so an important display:none beside them was ignored. Split declarations at top-level semicolons instead. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…alue Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
| let badString = false; | ||
| const declarations = style.replaceAll( | ||
| /\/\*[\s\S]*?(?:\*\/|$)|"[^"]*(?:"|$)|'[^']*(?:'|$)/g, | ||
| /(?<![\w-])url\((?![\t\n\f\r ]*["'])[^)]*(?:\)|$)|\/\*[\s\S]*?(?:\*\/|$)|"[^"]*(?:"|$)|'[^']*(?:'|$)/gi, |
There was a problem hiding this comment.
🟠 High provider/documentTextWorker.ts:299
hasImportantDisplayNone returns true for style="--a: #url(/*); display: none !important; --b: url(*/)", so the EPUB caller removes a visible element and its text even though display: none is inside a CSS comment. The URL matcher treats url( after # or a non-ASCII identifier character as a URL token and strips the comment delimiters; recognize CSS name-code-point and hash-token boundaries instead.
| /(?<![\w-])url\((?![\t\n\f\r ]*["'])[^)]*(?:\)|$)|\/\*[\s\S]*?(?:\*\/|$)|"[^"]*(?:"|$)|'[^']*(?:'|$)/gi, | |
| /(?<![#\w\u0080-\u{10FFFF}-])url\((?![\t\n\f\r ]*["'])[^)]*(?:\)|$)|\/\*[\s\S]*?(?:\*\/|$)|"[^"]*(?:"|$)|'[^']*(?:'|$)/giu, |
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/provider/documentTextWorker.ts around line 299:
`hasImportantDisplayNone` returns `true` for `style="--a: #url(/*); display: none !important; --b: url(*/)"`, so the EPUB caller removes a visible element and its text even though `display: none` is inside a CSS comment. The URL matcher treats `url(` after `#` or a non-ASCII identifier character as a URL token and strips the comment delimiters; recognize CSS name-code-point and hash-token boundaries instead.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — The change improves EPUB hidden-text filtering for styles containing transforms and other bracketed values. The reported CSS-tokenization issue can omit visible extracted text and remains subject to the separate correctness blocking gate. Needs human approval because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Text extracted from EPUB attachments included SVG labels hidden with an important
display: nonewhen the same inline style also had a value with brackets, such astransform: translate(10px), so agents could quote labels the reader hides. The style check now reads unquotedurl(...)values as single tokens and splits declarations only at top-level semicolons, so bracketed values no longer hide or reveal labels incorrectly.Reproduction on main
Commit 4ec5222ffd (main). The extracted text includes the hidden Closed ferry berth label. Expected: The extracted text includes the visible map labels and omits the hidden berth label.
The cause is at
apps/server/src/provider/documentTextWorker.ts:308. Rancd apps/server && pnpm exec vp test run src/provider/userInputAttachments.test.tswith the repro test added: it failed in 2 of 2 runs on a clean checkout, withnot to contain 'Closed ferry berth'in the output.Evidence
Environment: Linux x64, the repository's own tests.
Proven: the repro fails at the test commit 70e72927ef and passes on the head 2c6fc4acd0, both on main efbd62a7a7.
Tests
pnpm exec vp run check:changed efbd62a7a700a29ad545f8334b2139407875dab3passed on head.Not in this change
Who did the work
Made in T3 Code by Claude Opus 5.5 and GPT 6.2 Sol