From 91001228676ed6bc041451387c572af3661e42b7 Mon Sep 17 00:00:00 2001 From: Victor Vogel Date: Mon, 23 Nov 2026 19:26:45 +0000 Subject: [PATCH] fix(server): PowerPoint files whose presentation is not ppt/presentation.xml reach the agent --- .../server/src/provider/documentTextWorker.ts | 26 +++++++++---------- .../src/provider/userInputAttachments.test.ts | 22 ++++++++++++++++ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts index 2f5a05f22cdec..9ecef186efe77 100644 --- a/apps/server/src/provider/documentTextWorker.ts +++ b/apps/server/src/provider/documentTextWorker.ts @@ -659,6 +659,12 @@ async function* document(path: string, extension: string): AsyncGenerator + NodePath.posix.join( + NodePath.posix.dirname(name), + "_rels", + `${NodePath.posix.basename(name)}.rels`, + ); const relations = (name: string) => new Map( [...all(read(name), "Relationship")] @@ -708,9 +714,7 @@ async function* document(path: string, extension: string): AsyncGenerator NodePath.posix.resolve(`/${workbookDir}`, target).slice(1); const workbook = read(workbookPath); - const rels = relations( - NodePath.posix.join(workbookDir, "_rels", `${NodePath.posix.basename(workbookPath)}.rels`), - ); + const rels = relations(partRels(workbookPath)); const workbookRelations = [...rels.values()]; const workbookPartPath = (part: string) => { const target = workbookRelations.find((rel) => rel.Type?.endsWith(`/${part}`))?.Target; @@ -802,8 +806,10 @@ async function* document(path: string, extension: string): AsyncGenerator node.name === "sldIdLst"); const inheritedAttributes = { ...presentation?.attrs, ...slideList?.attrs }; let index = 0; @@ -814,15 +820,9 @@ async function* document(path: string, extension: string): AsyncGenerator { expected: ["Slide text"], absent: ["Notes:", "57"], }, + ...[ + { target: "deck/main.xml", prefix: "deck/" }, + { target: "/main.xml", prefix: "" }, + ].map(({ target, prefix }) => ({ + ext: "pptx", + bounded: true, + parts: { + "_rels/.rels": ``, + [`${prefix}main.xml`]: + '', + [`${prefix}_rels/main.xml.rels`]: + '', + [`${prefix}slides/one.xml`]: + "Harbor launch", + [`${prefix}slides/_rels/one.xml.rels`]: + '', + [`${prefix}notes/n1.xml`]: + "Check tide table", + }, + expected: ["## Slide 1", "Harbor launch\nNotes:\nCheck tide table"], + absent: ["[Skipped document part"], + })), ...[false, true].map((missing) => ({ ext: "pptx", bounded: true,