From 9a937891a8fcd49ca0d3313a18e40031f51df12a Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Thu, 20 Jan 2022 16:20:28 +0100 Subject: [PATCH] Fix reading template images in the browser --- .gitattributes | 2 ++ src/import-dotx/import-dotx.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..a657c95d5b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# https://prettier.io/docs/en/options.html#end-of-line +* text=auto eol=lf diff --git a/src/import-dotx/import-dotx.ts b/src/import-dotx/import-dotx.ts index 74a63b8ea4..3ef73208d8 100644 --- a/src/import-dotx/import-dotx.ts +++ b/src/import-dotx/import-dotx.ts @@ -157,7 +157,8 @@ export class ImportDotx { const hyperLinkReferences = this.findReferenceFiles(xmlRef).filter((r) => r.type === RelationshipType.HYPERLINK); for (const r of wrapperImagesReferences) { - const buffer = await zipContent.files[`word/${r.target}`].async("nodebuffer"); + const bufferType = JSZip.support.arraybuffer ? "arraybuffer" : "nodebuffer"; + const buffer = await zipContent.files[`word/${r.target}`].async(bufferType); const mediaData = media.addMedia(buffer, { width: 100, height: 100,