Skip to content

Commit 718c173

Browse files
committed
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.
1 parent 8cd585f commit 718c173

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/frank-oranges-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/cli-kit': patch
3+
---
4+
5+
Fix zip and brotliCompress functions to handle binary files

packages/cli-kit/src/public/node/archiver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {relativePath, joinPath, dirname} from './path.js'
2-
import {glob, removeFile, readFile} from './fs.js'
2+
import {glob, removeFile} from './fs.js'
33
import {outputDebug, outputContent, outputToken} from '../../public/node/output.js'
44
import archiver from 'archiver'
55
import {createWriteStream, readFileSync, writeFileSync} from 'fs'
6+
import {readFile} from 'fs/promises'
67
import {tmpdir} from 'os'
78
import {randomUUID} from 'crypto'
89

0 commit comments

Comments
 (0)