From 718c173bb6279ed14af9bd6d17a140885c152ada Mon Sep 17 00:00:00 2001 From: Gray Gilmore Date: Wed, 12 Nov 2025 14:01:56 -0800 Subject: [PATCH] Fix images not loading in theme app extensions Our wrapper around fs's `readFile` sets a default of `{encoding: 'utf8'}` to the options. This will cause any binary files (like images or fonts) to not be read properly. There isn't a way to disable the encoding based on how the function is currently typed so I'm switching to fs's version of `readFile` which will handle all file types correctly automatically. --- .changeset/frank-oranges-juggle.md | 5 +++++ packages/cli-kit/src/public/node/archiver.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/frank-oranges-juggle.md diff --git a/.changeset/frank-oranges-juggle.md b/.changeset/frank-oranges-juggle.md new file mode 100644 index 00000000000..b0f436c7093 --- /dev/null +++ b/.changeset/frank-oranges-juggle.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-kit': patch +--- + +Fix zip and brotliCompress functions to handle binary files diff --git a/packages/cli-kit/src/public/node/archiver.ts b/packages/cli-kit/src/public/node/archiver.ts index 5fd07767322..dda288526aa 100644 --- a/packages/cli-kit/src/public/node/archiver.ts +++ b/packages/cli-kit/src/public/node/archiver.ts @@ -1,8 +1,9 @@ import {relativePath, joinPath, dirname} from './path.js' -import {glob, removeFile, readFile} from './fs.js' +import {glob, removeFile} from './fs.js' import {outputDebug, outputContent, outputToken} from '../../public/node/output.js' import archiver from 'archiver' import {createWriteStream, readFileSync, writeFileSync} from 'fs' +import {readFile} from 'fs/promises' import {tmpdir} from 'os' import {randomUUID} from 'crypto'