Skip to content

Commit

Permalink
Merge pull request #5048 from Shopify/gg-fix-empty-file-upload
Browse files Browse the repository at this point in the history
Allow empty theme files to be uploaded
  • Loading branch information
shauns authored Dec 6, 2024
2 parents 7835a90 + 94953a6 commit 8cd1218
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-cobras-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-kit': patch
---

Fix bug preventing empty theme files from uploading
14 changes: 6 additions & 8 deletions packages/cli-kit/src/public/node/themes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,22 @@ export async function bulkUploadThemeAssets(

function prepareFilesForUpload(assets: AssetParams[]): OnlineStoreThemeFilesUpsertFileInput[] {
return assets.map((asset) => {
if (asset.value) {
if (asset.attachment) {
return {
filename: asset.key,
body: {
type: 'TEXT' as const,
value: asset.value,
type: 'BASE64' as const,
value: asset.attachment,
},
}
} else if (asset.attachment) {
} else {
return {
filename: asset.key,
body: {
type: 'BASE64' as const,
value: asset.attachment,
type: 'TEXT' as const,
value: asset.value ?? '',
},
}
} else {
unexpectedGraphQLError('Asset must have a value or attachment')
}
})
}
Expand Down

0 comments on commit 8cd1218

Please sign in to comment.