From 70e72927ef047e3d1b1b572c3370a5dce291499b Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 3 Dec 2026 22:57:09 +0100 Subject: [PATCH 1/3] test(server): EPUB map text omits hidden groups with transforms Co-authored-by: Claude Opus 5.5 --- apps/server/src/provider/userInputAttachments.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/server/src/provider/userInputAttachments.test.ts b/apps/server/src/provider/userInputAttachments.test.ts index 10adf6fa989b0..c020d8affc193 100644 --- a/apps/server/src/provider/userInputAttachments.test.ts +++ b/apps/server/src/provider/userInputAttachments.test.ts @@ -1274,6 +1274,11 @@ describe("question answer paths", () => { "fig.svg": 'Standalone SVG metadata' + 'Superseded gate' + + 'Closed ferry berth' + + 'Old pier' + + 'Harbour light' + + 'Ferry timetable' + + 'Old legend' + 'Standalone chart', }, expected: [ @@ -1282,6 +1287,8 @@ describe("question answer paths", () => { "Q4 Revenue", "Foreign metadata", "Prefixed label", + "Harbour light", + "Ferry timetable", "Standalone chart", ], absent: [ @@ -1291,6 +1298,9 @@ describe("question answer paths", () => { "Prefixed SVG metadata", "Standalone SVG metadata", "Superseded gate", + "Closed ferry berth", + "Old pier", + "Old legend", ], }, { From 1d5221bdfca878eccd97bbcdd5fc0cd75296b3f9 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 3 Dec 2026 22:59:55 +0100 Subject: [PATCH 2/3] fix(server): EPUB text skips hidden map groups that also set a transform 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 --- .../server/src/provider/documentTextWorker.ts | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts index 4b5002250eb28..41b895c7e2efe 100644 --- a/apps/server/src/provider/documentTextWorker.ts +++ b/apps/server/src/provider/documentTextWorker.ts @@ -304,10 +304,27 @@ function hasImportantDisplayNone(style: string): boolean { return '""'; }, ); - // Semicolons in blocks can be part of a declaration's value. - if (badString || /[()[\]{}]/.test(declarations)) return false; + if (badString) return false; + // Semicolons in blocks are part of a declaration's value, so split only at depth zero. + const closers: string[] = []; + const parts: string[] = []; + let start = 0; + for (let index = 0; index < declarations.length; index++) { + const char = declarations[index]; + if (char === "(") closers.push(")"); + else if (char === "[") closers.push("]"); + else if (char === "{") closers.push("}"); + else if (char === ")" || char === "]" || char === "}") { + if (closers.pop() !== char) return false; + } else if (char === ";" && closers.length === 0) { + parts.push(declarations.slice(start, index)); + start = index + 1; + } + } + if (closers.length > 0) return false; + parts.push(declarations.slice(start)); let hidden = false; - for (const [declaration] of declarations.matchAll(/[^;]+/g)) { + for (const declaration of parts) { const match = /^[\t\n\f\r ]*(display|all)[\t\n\f\r ]*:([^!]+)![\t\n\f\r ]*important[\t\n\f\r ]*$/i.exec( declaration, From 2c6fc4acd098616508f3247894100d1aeff6b1e6 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 3 Dec 2026 23:06:33 +0100 Subject: [PATCH 3/3] fix(server): EPUB hidden-style check reads unquoted CSS URLs as one value Co-authored-by: Claude Opus 5.5 --- apps/server/src/provider/documentTextWorker.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts index 41b895c7e2efe..f3d7e0b3d360f 100644 --- a/apps/server/src/provider/documentTextWorker.ts +++ b/apps/server/src/provider/documentTextWorker.ts @@ -296,9 +296,14 @@ function hasImportantDisplayNone(style: string): boolean { return false; let badString = false; const declarations = style.replaceAll( - /\/\*[\s\S]*?(?:\*\/|$)|"[^"]*(?:"|$)|'[^']*(?:'|$)/g, + /(? { if (token.startsWith("/")) return " "; + // Unquoted URLs keep comment and bracket characters as content. + if (/^url/i.test(token)) { + if (!/^url\([\t\n\f\r ]*[^\s"'()]*[\t\n\f\r ]*\)$/i.test(token)) badString = true; + return "url()"; + } // CSS ends a string at a newline, so later declarations can still apply. if (/[\n\r\f]/.test(token)) badString = true; return '""';