Merge pull request #199 from public-awesome/avoid-escaping-line-breaks

Fix: Use replaceAll instead of replace to ignore all escaped line breaks
This commit is contained in:
Adnan Deniz Corlu 2023-08-04 12:01:49 +03:00 committed by GitHub
commit fa859b23d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -244,7 +244,7 @@ export const CollectionActions = ({
const resolveRoyaltyPaymentAddress = async () => { const resolveRoyaltyPaymentAddress = async () => {
await resolveAddress(royaltyPaymentAddressState.value.trim(), wallet).then((resolvedAddress) => { await resolveAddress(royaltyPaymentAddressState.value.trim(), wallet).then((resolvedAddress) => {
setCollectionInfo({ setCollectionInfo({
description: descriptionState.value.replace('\\n', '\n') || undefined, description: descriptionState.value.replaceAll('\\n', '\n') || undefined,
image: imageState.value || undefined, image: imageState.value || undefined,
explicit_content: explicitContent, explicit_content: explicitContent,
external_link: externalLinkState.value || undefined, external_link: externalLinkState.value || undefined,
@ -265,7 +265,7 @@ export const CollectionActions = ({
useEffect(() => { useEffect(() => {
setCollectionInfo({ setCollectionInfo({
description: descriptionState.value.replace('\\n', '\n') || undefined, description: descriptionState.value.replaceAll('\\n', '\n') || undefined,
image: imageState.value || undefined, image: imageState.value || undefined,
explicit_content: explicitContent, explicit_content: explicitContent,
external_link: externalLinkState.value || undefined, external_link: externalLinkState.value || undefined,

View File

@ -436,7 +436,7 @@ export const OpenEditionMinterCreator = ({
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 // eslint-disable-next-line @typescript-eslint/no-unsafe-call
data.description = data.description.replace('\\n', '\n') data.description = data.description.replaceAll('\\n', '\n')
const metadataFileBlob = new Blob([JSON.stringify(data)], { const metadataFileBlob = new Blob([JSON.stringify(data)], {
type: 'application/json', type: 'application/json',
}) })
@ -498,7 +498,7 @@ export const OpenEditionMinterCreator = ({
? { ? {
image: uri, image: uri,
name: onChainMetadataInputDetails?.name, name: onChainMetadataInputDetails?.name,
description: onChainMetadataInputDetails?.description?.replace('\\n', '\n'), description: onChainMetadataInputDetails?.description?.replaceAll('\\n', '\n'),
attributes: onChainMetadataInputDetails?.attributes, attributes: onChainMetadataInputDetails?.attributes,
external_url: onChainMetadataInputDetails?.external_url, external_url: onChainMetadataInputDetails?.external_url,
animation_url: animation_url:
@ -526,7 +526,7 @@ export const OpenEditionMinterCreator = ({
symbol: collectionDetails?.symbol, symbol: collectionDetails?.symbol,
info: { info: {
creator: wallet.address, creator: wallet.address,
description: collectionDetails?.description.replace('\\n', '\n'), description: collectionDetails?.description.replaceAll('\\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?.replace('\\n', '\n') || undefined, description: badgeDetails?.description?.replaceAll('\\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.replace('\\n', '\n'), description: collectionDetails?.description.replaceAll('\\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.replace('\\n', '\n'), description: collectionDetails?.description.replaceAll('\\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}`
@ -736,7 +736,7 @@ const CollectionCreationPage: NextPage = () => {
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 // eslint-disable-next-line @typescript-eslint/no-unsafe-call
data.description = data.description.replace('\\n', '\n') data.description = data.description.replaceAll('\\n', '\n')
const metadataFileBlob = new Blob([JSON.stringify(data)], { const metadataFileBlob = new Blob([JSON.stringify(data)], {
type: 'application/json', type: 'application/json',
}) })
@ -792,7 +792,7 @@ const CollectionCreationPage: NextPage = () => {
}) })
// eslint-disable-next-line @typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-call
data.description = data.description.replace('\\n', '\n') data.description = data.description.replaceAll('\\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],