Skip to content

Commit

Permalink
Merge pull request #5015 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
graygilmore authored Dec 4, 2024
2 parents 7d2f856 + 6797334 commit c92d0a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Theme team and CLI owners should review theme changes
packages/cli-kit/src/private/themes/* @shopify/advanced-edits @shopify/app-inner-loop
packages/cli-kit/src/public/themes/* @shopify/advanced-edits @shopify/app-inner-loop
packages/cli-kit/src/public/**/themes/* @shopify/advanced-edits @shopify/app-inner-loop
packages/theme/** @shopify/advanced-edits @shopify/app-inner-loop

# These are metafiles that can be reviewed by anyone
Expand Down
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 c92d0a2

Please sign in to comment.