Avoid escaping line breaks in token and collection descriptions

This commit is contained in:
Serkan Reis 2023-08-04 10:11:34 +03:00
parent b66c6befd2
commit 3d527c6682
3 changed files with 11 additions and 5 deletions

View File

@ -435,6 +435,8 @@ export const OpenEditionMinterCreator = ({
if (getAssetType(offChainMetadataUploadDetails.assetFiles[0].name) !== 'html') if (getAssetType(offChainMetadataUploadDetails.assetFiles[0].name) !== 'html')
data.image = `ipfs://${assetUri}/${offChainMetadataUploadDetails.assetFiles[0].name}` data.image = `ipfs://${assetUri}/${offChainMetadataUploadDetails.assetFiles[0].name}`
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
data.description = data.description.replace('\\n', '\n')
const metadataFileBlob = new Blob([JSON.stringify(data)], { const metadataFileBlob = new Blob([JSON.stringify(data)], {
type: 'application/json', type: 'application/json',
}) })
@ -496,7 +498,7 @@ export const OpenEditionMinterCreator = ({
? { ? {
image: uri, image: uri,
name: onChainMetadataInputDetails?.name, name: onChainMetadataInputDetails?.name,
description: onChainMetadataInputDetails?.description, description: onChainMetadataInputDetails?.description?.replace('\\n', '\n'),
attributes: onChainMetadataInputDetails?.attributes, attributes: onChainMetadataInputDetails?.attributes,
external_url: onChainMetadataInputDetails?.external_url, external_url: onChainMetadataInputDetails?.external_url,
animation_url: animation_url:
@ -524,7 +526,7 @@ export const OpenEditionMinterCreator = ({
symbol: collectionDetails?.symbol, symbol: collectionDetails?.symbol,
info: { info: {
creator: wallet.address, creator: wallet.address,
description: collectionDetails?.description, description: collectionDetails?.description.replace('\\n', '\n'),
image: coverImageUri, image: coverImageUri,
explicit_content: collectionDetails?.explicit || false, explicit_content: collectionDetails?.explicit || false,
royalty_info: royaltyInfo, royalty_info: royaltyInfo,

View File

@ -189,7 +189,7 @@ const BadgeCreationPage: NextPage = () => {
manager: badgeDetails?.manager as string, manager: badgeDetails?.manager as string,
metadata: { metadata: {
name: badgeDetails?.name || undefined, name: badgeDetails?.name || undefined,
description: badgeDetails?.description || undefined, description: badgeDetails?.description?.replace('\\n', '\n') || undefined,
image: coverUrl || undefined, image: coverUrl || undefined,
image_data: badgeDetails?.image_data || undefined, image_data: badgeDetails?.image_data || undefined,
external_url: badgeDetails?.external_url || undefined, external_url: badgeDetails?.external_url || undefined,

View File

@ -547,7 +547,7 @@ const CollectionCreationPage: NextPage = () => {
symbol: collectionDetails?.symbol, symbol: collectionDetails?.symbol,
info: { info: {
creator: wallet.address, creator: wallet.address,
description: collectionDetails?.description, description: collectionDetails?.description.replace('\\n', '\n'),
image: `${ image: `${
uploadDetails?.uploadMethod === 'new' uploadDetails?.uploadMethod === 'new'
? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}`
@ -613,7 +613,7 @@ const CollectionCreationPage: NextPage = () => {
symbol: collectionDetails?.symbol, symbol: collectionDetails?.symbol,
info: { info: {
creator: wallet.address, creator: wallet.address,
description: collectionDetails?.description, description: collectionDetails?.description.replace('\\n', '\n'),
image: `${ image: `${
uploadDetails?.uploadMethod === 'new' uploadDetails?.uploadMethod === 'new'
? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}`
@ -735,6 +735,8 @@ const CollectionCreationPage: NextPage = () => {
if (getAssetType(uploadDetails.assetFiles[i].name) !== 'html') if (getAssetType(uploadDetails.assetFiles[i].name) !== 'html')
data.image = `ipfs://${assetUri}/${uploadDetails.assetFiles[i].name}` data.image = `ipfs://${assetUri}/${uploadDetails.assetFiles[i].name}`
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
data.description = data.description.replace('\\n', '\n')
const metadataFileBlob = new Blob([JSON.stringify(data)], { const metadataFileBlob = new Blob([JSON.stringify(data)], {
type: 'application/json', type: 'application/json',
}) })
@ -789,6 +791,8 @@ const CollectionCreationPage: NextPage = () => {
type: 'application/json', type: 'application/json',
}) })
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
data.description = data.description.replace('\\n', '\n')
console.log('Name: ', (uploadDetails.baseMinterMetadataFile as File).name) console.log('Name: ', (uploadDetails.baseMinterMetadataFile as File).name)
const updatedMetadataFile = new File( const updatedMetadataFile = new File(
[metadataFileBlob], [metadataFileBlob],