From 94953a671ed48f0186834a7d989842abff2f1193 Mon Sep 17 00:00:00 2001 From: Gray Gilmore Date: Tue, 3 Dec 2024 10:58:19 -0800 Subject: [PATCH] Allow empty theme files to be uploaded --- .changeset/honest-cobras-invite.md | 5 +++++ packages/cli-kit/src/public/node/themes/api.ts | 14 ++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 .changeset/honest-cobras-invite.md diff --git a/.changeset/honest-cobras-invite.md b/.changeset/honest-cobras-invite.md new file mode 100644 index 00000000000..d50dc7836a8 --- /dev/null +++ b/.changeset/honest-cobras-invite.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-kit': patch +--- + +Fix bug preventing empty theme files from uploading diff --git a/packages/cli-kit/src/public/node/themes/api.ts b/packages/cli-kit/src/public/node/themes/api.ts index 23966667812..706a9eae093 100644 --- a/packages/cli-kit/src/public/node/themes/api.ts +++ b/packages/cli-kit/src/public/node/themes/api.ts @@ -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') } }) }