From 26a54235999486631dd56547cf41f3ece4b6dc42 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Tue, 22 Aug 2023 21:52:31 +0300 Subject: [PATCH] Address upload issue when token metadata lacks a description --- components/openEdition/OpenEditionMinterCreator.tsx | 6 ++++-- pages/collections/create.tsx | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/components/openEdition/OpenEditionMinterCreator.tsx b/components/openEdition/OpenEditionMinterCreator.tsx index 1c62c29..190c279 100644 --- a/components/openEdition/OpenEditionMinterCreator.tsx +++ b/components/openEdition/OpenEditionMinterCreator.tsx @@ -468,8 +468,10 @@ export const OpenEditionMinterCreator = ({ if (getAssetType(offChainMetadataUploadDetails.assetFiles[0].name) !== 'html') data.image = `ipfs://${assetUri}/${offChainMetadataUploadDetails.assetFiles[0].name}` - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - data.description = data.description.replaceAll('\\n', '\n') + if (data.description) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replaceAll('\\n', '\n') + } const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 008830f..2137308 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -741,8 +741,10 @@ const CollectionCreationPage: NextPage = () => { if (getAssetType(uploadDetails.assetFiles[i].name) !== 'html') data.image = `ipfs://${assetUri}/${uploadDetails.assetFiles[i].name}` - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - data.description = data.description.replaceAll('\\n', '\n') + if (data.description) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replaceAll('\\n', '\n') + } const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -797,8 +799,10 @@ const CollectionCreationPage: NextPage = () => { type: 'application/json', }) - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - data.description = data.description.replaceAll('\\n', '\n') + if (data.description) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replaceAll('\\n', '\n') + } console.log('Name: ', (uploadDetails.baseMinterMetadataFile as File).name) const updatedMetadataFile = new File( [metadataFileBlob],