From 4251ebc8877f333ba93379071f4fe49f70eebd6e Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 2 Oct 2026 08:43:10 -0700 Subject: [PATCH] fix(deps): bump mammoth to 1.12.3 --- .../lib/file-parsers/parser-formats.test.ts | 30 ++++++++++++++++++- apps/sim/package.json | 2 +- bun.lock | 4 +-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/apps/sim/lib/file-parsers/parser-formats.test.ts b/apps/sim/lib/file-parsers/parser-formats.test.ts index 9eeac643dfc..dfe1ae82cc6 100644 --- a/apps/sim/lib/file-parsers/parser-formats.test.ts +++ b/apps/sim/lib/file-parsers/parser-formats.test.ts @@ -45,7 +45,7 @@ function buildPptx(slideBodyXml: string, macroEnabled = false): Promise return zip.generateAsync({ type: 'nodebuffer' }) as Promise } -function buildDocx(bodyXml: string, macroEnabled = false): Promise { +function buildDocx(bodyXml: string, macroEnabled = false, stylesXml?: string): Promise { const mainType = macroEnabled ? 'application/vnd.ms-word.document.macroEnabled.main+xml' : 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml' @@ -62,6 +62,16 @@ function buildDocx(bodyXml: string, macroEnabled = false): Promise { 'word/document.xml', `${bodyXml}` ) + if (stylesXml) { + zip.file( + 'word/_rels/document.xml.rels', + `` + ) + zip.file( + 'word/styles.xml', + `${stylesXml}` + ) + } return zip.generateAsync({ type: 'nodebuffer' }) as Promise } @@ -138,6 +148,24 @@ describe('DocxParser', () => { expect(error).toBeInstanceOf(FileParserError) expect(error).toMatchObject({ code: 'no_extractable_text' }) }) + + it('ignores a style definition with an unrecognized type', async () => { + const key = 'unrecognizedStyleType' + const buffer = await buildDocx( + 'Quarterly plan', + false, + `` + ) + + try { + const result = await new DocxParser().parseBuffer(buffer) + + expect(result.content).toContain('Quarterly plan') + expect(Object.hasOwn(Object.prototype, key)).toBe(false) + } finally { + delete (Object.prototype as Record)[key] + } + }) }) describe('OpenDocumentParser', () => { diff --git a/apps/sim/package.json b/apps/sim/package.json index 3e5c27b51ec..3bd7ed252be 100644 --- a/apps/sim/package.json +++ b/apps/sim/package.json @@ -206,7 +206,7 @@ "jszip": "3.10.1", "lib0": "0.2.117", "lru-cache": "11.3.6", - "mammoth": "^1.9.0", + "mammoth": "1.12.3", "marked": "18.0.11", "mermaid": "11.16.1", "micromatch": "4.0.8", diff --git a/bun.lock b/bun.lock index 99d433f3586..3dc4a7980b7 100644 --- a/bun.lock +++ b/bun.lock @@ -333,7 +333,7 @@ "jszip": "3.10.1", "lib0": "0.2.117", "lru-cache": "11.3.6", - "mammoth": "^1.9.0", + "mammoth": "1.12.3", "marked": "18.0.11", "mermaid": "11.16.1", "micromatch": "4.0.8", @@ -3706,7 +3706,7 @@ "make-event-props": ["make-event-props@2.0.0", "", {}, "sha512-G/hncXrl4Qt7mauJEXSg3AcdYzmpkIITTNl5I+rH9sog5Yw0kK6vseJjCaPfOXqOqQuPUP89Rkhfz5kPS8ijtw=="], - "mammoth": ["mammoth@1.12.0", "", { "dependencies": { "@xmldom/xmldom": "^0.8.6", "argparse": "~1.0.3", "base64-js": "^1.5.1", "bluebird": "~3.4.0", "dingbat-to-unicode": "^1.0.1", "jszip": "^3.7.1", "lop": "^0.4.2", "path-is-absolute": "^1.0.0", "underscore": "^1.13.1", "xmlbuilder": "^10.0.0" }, "bin": { "mammoth": "bin/mammoth" } }, "sha512-cwnK1RIcRdDMi2HRx2EXGYlxqIEh0Oo3bLhorgnsVJi2UkbX1+jKxuBNR9PC5+JaX7EkmJxFPmo6mjLpqShI2w=="], + "mammoth": ["mammoth@1.12.3", "", { "dependencies": { "@xmldom/xmldom": "^0.8.6", "argparse": "~1.0.3", "base64-js": "^1.5.1", "bluebird": "~3.4.0", "dingbat-to-unicode": "^1.0.1", "jszip": "^3.7.1", "lop": "^0.4.2", "path-is-absolute": "^1.0.0", "underscore": "^1.13.1", "xmlbuilder": "^10.0.0" }, "bin": { "mammoth": "bin/mammoth" } }, "sha512-kkv2MrSFk3f/w3uLsz4FG/91LdWp2j+qmp7AjG2v7w2xgX5YDxiaFlaWourXrXtyUR6335+9guyIlPBnhHLvKw=="], "markdown-extensions": ["markdown-extensions@2.0.0", "", {}, "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q=="],