Skip to content

Commit

Permalink
Merge pull request #4484 from Shopify/jm/bp-4475
Browse files Browse the repository at this point in the history
[3.67] - Account for empty assets when calculating theme asset size
  • Loading branch information
jamesmengo authored Sep 19, 2024
2 parents 35a1a61 + d3b7162 commit 8410e97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-sloths-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-kit': patch
---

Fix a bug when building empty theme assets
6 changes: 3 additions & 3 deletions packages/cli-kit/src/public/node/themes/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ interface RemoteThemeResponse {
interface RemoteAssetResponse {
key: string
checksum: string
attachment: string
attachment: string | undefined
// value is an empty string ('') when the file is empty
value: string
}

Expand Down Expand Up @@ -52,8 +53,7 @@ export function buildThemeAsset(asset?: RemoteAssetResponse): ThemeAsset | undef

const {key, checksum, attachment, value} = asset
// Note: for attachments, this is the size of the base64 string, not the real length of the file
const stats = {size: (value || attachment).length, mtime: Date.now()}

const stats = {size: (value || attachment || '').length, mtime: Date.now()}
return {key, checksum, attachment, value, stats}
}

Expand Down

0 comments on commit 8410e97

Please sign in to comment.