@devries-cameron20 / t3code-1 / commits / 7b4478895d
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): omit page-specific headers and footers from RTF text (#38347)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Simone committed Nov 17, 2026 at 23:25 UTC 7b4478895daf4f71da216131dbb629ba04271dcf
2 files changed +16 -1
apps/server/src/provider/documentTextWorker.ts
+6
@@ -454,7 +454,13 @@ function* rtf(source: string): Generator<string, void> {
454 "object",
455 "fldinst",
456 "header",
457 + "headerf",
458 + "headerl",
459 + "headerr",
460 "footer",
461 + "footerf",
462 + "footerl",
463 + "footerr",
464 ].includes(control)
465 )
466 state.skip = true;
apps/server/src/provider/userInputAttachments.test.ts
+10 -1
@@ -277,6 +277,15 @@ describe("question answer paths", () => {
277 );
278
279 it.effect.each([
280 + [
281 + "page-specific headers and footers",
282 + String.raw`{\rtf1\ansi\facingp\sectd\titlepg
283 +{\headerf First-page header}{\headerl Left-page header}{\headerr Right-page header}
284 +{\footerf First-page footer}{\footerl Left-page footer}{\footerr Right-page footer}
285 +\pard Approved delivery date: 24 November.\par
286 +}`,
287 + "Approved delivery date: 24 November.",
288 + ],
289 [
290 "text symbols",
291 String.raw`{\rtf1\ansi Pages 1\endash 5\emdash\lquote left\rquote\ldblquote right\rdblquote\bullet\b End\b0\unknown{\*\secret\bullet hidden}}`,
@@ -310,7 +319,7 @@ describe("question answer paths", () => {
319 ["large fallback", String.raw`{\rtf1\ansi\uc20\u945????????????????????Z}`, "αZ"],
320 ["no fallback", String.raw`{\rtf1\ansi\uc0\u945Z}`, "αZ"],
321 ["scoped count", String.raw`{\rtf1\ansi{\uc2\u945??}\u946?Z}`, "αβZ"],
313 - ] as const)("extracts RTF symbols and Unicode fallbacks: %s", ([name, source, expected]) =>
322 + ] as const)("extracts RTF text: %s", ([name, source, expected]) =>
323 Effect.gen(function* () {
324 const config = yield* ServerConfig.ServerConfig;
325 const path = NodePath.join(config.attachmentsDir, `${name}.rtf`);