Skip to content

Commit 8cd1218

Browse files
authored
Merge pull request #5048 from Shopify/gg-fix-empty-file-upload
Allow empty theme files to be uploaded
2 parents 7835a90 + 94953a6 commit 8cd1218

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.changeset/honest-cobras-invite.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 bug preventing empty theme files from uploading

packages/cli-kit/src/public/node/themes/api.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,22 @@ export async function bulkUploadThemeAssets(
119119

120120
function prepareFilesForUpload(assets: AssetParams[]): OnlineStoreThemeFilesUpsertFileInput[] {
121121
return assets.map((asset) => {
122-
if (asset.value) {
122+
if (asset.attachment) {
123123
return {
124124
filename: asset.key,
125125
body: {
126-
type: 'TEXT' as const,
127-
value: asset.value,
126+
type: 'BASE64' as const,
127+
value: asset.attachment,
128128
},
129129
}
130-
} else if (asset.attachment) {
130+
} else {
131131
return {
132132
filename: asset.key,
133133
body: {
134-
type: 'BASE64' as const,
135-
value: asset.attachment,
134+
type: 'TEXT' as const,
135+
value: asset.value ?? '',
136136
},
137137
}
138-
} else {
139-
unexpectedGraphQLError('Asset must have a value or attachment')
140138
}
141139
})
142140
}

0 commit comments

Comments
 (0)