The best way to control Claude Code, Codex and more from any computer or phone
fix(server): preserve explicit document breaks in RTF attachment text (#38598)
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Simone committed
Nov 18, 2026 at 14:31 UTC
7396f135ed67e52fe839c9867f78f7b2adc1d6f2
2 files changed
+10
-1
apps/server/src/provider/documentTextWorker.ts
+5
-1
@@ -494,7 +494,11 @@ function* rtf(source: string): Generator<string, void> {
494
} else if (control === "u" && !state.skip) {
495
yield String.fromCharCode(value < 0 ? value + 65536 : value);
496
fallback = state.uc;
497
- } else if (!state.skip && ["par", "line", "row"].includes(control)) yield "\n";
497
+ } else if (
498
+ !state.skip &&
499
+ ["par", "line", "row", "sect", "page", "column"].includes(control)
500
+ )
501
+ yield "\n";
502
else if (!state.skip && ["tab", "cell"].includes(control)) yield "\t";
503
else if (!state.skip && symbols.has(control)) yield symbols.get(control)!;
504
} else {
apps/server/src/provider/userInputAttachments.test.ts
+5
@@ -309,6 +309,11 @@ describe("question answer paths", () => {
309
["hyphen symbol fallback", String.raw`{\rtf1\ansi\uc3\u945\~\_\-Z}`, "αZ"],
310
["control word", String.raw`{\rtf1\ansi A\u9\tab X}`, "A\tX"],
311
["line break paragraphs", "{\\rtf1\\ansi First\\\nSecond\\\r\nThird}", "First\nSecond\nThird"],
312
+ [
313
+ "document breaks",
314
+ String.raw`{\rtf1\ansi\sectd\cols2\pard North quota: 120\column South quota: 240\page East quota: 360\sect\sectd\pard West quota: 480\par}`,
315
+ "North quota: 120\nSouth quota: 240\nEast quota: 360\nWest quota: 480",
316
+ ],
317
["group close", String.raw`{\rtf1\ansi{\u945}Z}`, "αZ"],
318
["group open", String.raw`{\rtf1\ansi\u945{Z}}`, "αZ"],
319
["hex byte", String.raw`{\rtf1\ansi\u945\'3fZ}`, "αZ"],