Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/server/src/provider/documentTextWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function xml(source: string, odfSpaces = false, htmlEntities = false): XmlNode {
stack.push(node);
});
parser.on("closetag", () => {
stack.pop();
// Markup-compatibility fallbacks repeat their mc:Choice content, e.g. Word text boxes.
if (stack.pop()!.name === "Fallback") stack.at(-1)!.children.pop();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
});
const text = (value: string) => {
stack.at(-1)!.children.push(value);
Expand Down
10 changes: 10 additions & 0 deletions apps/server/src/provider/userInputAttachments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,16 @@ describe("question answer paths", () => {
expected: ["Start", "[Extracted text truncated at document extraction limits.]"],
absent: ["Unneeded"],
},
{
ext: "docx",
bounded: true,
parts: {
"word/document.xml":
'<w:document xmlns:w="urn:w" xmlns:mc="urn:mc"><w:body><w:p><w:r><w:t>Body</w:t></w:r></w:p><w:p><w:r><mc:AlternateContent><mc:Choice Requires="wps"><w:drawing><wps:wsp><wps:txbx><w:txbxContent><w:p><w:r><w:t>Callout box</w:t></w:r></w:p></w:txbxContent></wps:txbx></wps:wsp></w:drawing></mc:Choice><mc:Fallback><w:pict><v:shape><v:textbox><w:txbxContent><w:p><w:r><w:t>Callout box</w:t></w:r></w:p></w:txbxContent></v:textbox></v:shape></w:pict></mc:Fallback></mc:AlternateContent></w:r></w:p></w:body></w:document>',
},
expected: ["Body\nCallout box"],
occurrences: { text: "Callout box", count: 1 },
},
{
ext: "docx",
bounded: true,
Expand Down
Loading