diff --git a/apps/web/src/components/files/FilePreviewPanel.test.ts b/apps/web/src/components/files/FilePreviewPanel.test.ts
index 4c9d8b0f9a67..4b736d8b6622 100644
--- a/apps/web/src/components/files/FilePreviewPanel.test.ts
+++ b/apps/web/src/components/files/FilePreviewPanel.test.ts
@@ -519,16 +519,33 @@ Third}`;
expect(result.pages[0]!.html).toBe(`
`);
});
+ // LibreOffice writes every index as the templates it was built from, then the built index.
+ const indexes = [
+ "table-of-content",
+ "illustration-index",
+ "table-index",
+ "object-index",
+ "user-index",
+ "alphabetical-index",
+ "bibliography",
+ ].map(
+ (name) =>
+ `Index: IndexField notes: 1`,
+ );
it.each(["odt", "odp"] as const)("reads %s text and rejects unsupported XML", async (kind) => {
const archive = new JSZip().file(
"content.xml",
- `${kind === "odt" ? "Field notes" : 'Launch planSpeaker only'}`,
+ `${kind === "odt" ? `Field notes${indexes.join("")}` : 'Launch planSpeaker only'}`,
);
const result = await openDocument(archive, kind);
expect(result.type).toBe("document");
if (result.type !== "document") throw new Error("Expected document");
expect(result.pages[0]!.html).toContain(kind === "odt" ? "Field notes" : "Launch plan");
expect(result.pages[0]!.html).not.toContain("Speaker only");
+ if (kind === "odt")
+ expect(result.pages[0]!.html).toBe(
+ `Field notes
${"Index
Field notes: 1
".repeat(indexes.length)}`,
+ );
for (const source of [
']>&external;',
'x
]>&e;',
diff --git a/apps/web/src/components/files/extendedDocumentPreview.ts b/apps/web/src/components/files/extendedDocumentPreview.ts
index 07a8713b0820..7d6021de6f81 100644
--- a/apps/web/src/components/files/extendedDocumentPreview.ts
+++ b/apps/web/src/components/files/extendedDocumentPreview.ts
@@ -288,6 +288,13 @@ async function odfHtml(node: XmlNode, archive: JSZip): Promise {
"office:scripts",
"draw:object",
"draw:object-ole",
+ "text:table-of-content-source",
+ "text:illustration-index-source",
+ "text:table-index-source",
+ "text:object-index-source",
+ "text:user-index-source",
+ "text:alphabetical-index-source",
+ "text:bibliography-source",
].includes(node.name)
)
return "";