Address upload issue when token metadata lacks a description

This commit is contained in:
Serkan Reis 2023-08-22 21:52:31 +03:00
parent 958671a030
commit 26a5423599
2 changed files with 12 additions and 6 deletions

View File

@ -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',
})

View File

@ -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],