From 709bcc859a278b3a4f4ed37b8181b0573a4fb8f3 Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Fri, 27 Oct 2023 17:47:12 +0200 Subject: [PATCH 1/3] fix: avoid uploading gif files twice --- src/data/ipfs.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/data/ipfs.ts b/src/data/ipfs.ts index f1e9ce73f..bb2a4ab60 100644 --- a/src/data/ipfs.ts +++ b/src/data/ipfs.ts @@ -224,7 +224,17 @@ export const prepareFile = async ({ // upload thumbnail image let thumbnailUri = IPFS_DEFAULT_THUMBNAIL_URI - if (thumbnail) { + if(thumbnail && thumbnail.file?.type == 'image/gif') { + console.debug('GIF format detected, use the same cid for thumbnail to avoid uploading again') + thumbnailUri = `${uri}` + if (thumbnail?.format) { + const format = JSON.parse(JSON.stringify(thumbnail.format)) + format.uri = thumbnailUri + format.fileName = `thumbnail_${format.fileName}` + formats.push(format) + console.debug('thumbnail format', format) + } + } else if (thumbnail) { const thumbnailCid = await uploadFileToIPFSProxy({ blob: new Blob([thumbnail.buffer]), path: `thumbnail_${ From f28b84ad4e6b7b52ea632fdfe451df310b34d94a Mon Sep 17 00:00:00 2001 From: melMass Date: Fri, 27 Oct 2023 23:34:36 +0200 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E2=9A=A1=EF=B8=8F=20x3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/ipfs.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/data/ipfs.ts b/src/data/ipfs.ts index bb2a4ab60..1c16213e8 100644 --- a/src/data/ipfs.ts +++ b/src/data/ipfs.ts @@ -224,8 +224,10 @@ export const prepareFile = async ({ // upload thumbnail image let thumbnailUri = IPFS_DEFAULT_THUMBNAIL_URI - if(thumbnail && thumbnail.file?.type == 'image/gif') { - console.debug('GIF format detected, use the same cid for thumbnail to avoid uploading again') + if (thumbnail && thumbnail.file?.type === 'image/gif') { + console.debug( + 'GIF format detected, use the same cid for thumbnail to avoid uploading again' + ) thumbnailUri = `${uri}` if (thumbnail?.format) { const format = JSON.parse(JSON.stringify(thumbnail.format)) From 59234e97f0114b569761725dbc713c0707aa78c3 Mon Sep 17 00:00:00 2001 From: melMass Date: Fri, 27 Oct 2023 23:48:44 +0200 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=E2=9A=A1=EF=B8=8F=20changed=20the?= =?UTF-8?q?=20debug=20message=20a=20bit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/ipfs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/ipfs.ts b/src/data/ipfs.ts index 1c16213e8..0bdb04cc8 100644 --- a/src/data/ipfs.ts +++ b/src/data/ipfs.ts @@ -226,7 +226,7 @@ export const prepareFile = async ({ let thumbnailUri = IPFS_DEFAULT_THUMBNAIL_URI if (thumbnail && thumbnail.file?.type === 'image/gif') { console.debug( - 'GIF format detected, use the same cid for thumbnail to avoid uploading again' + "GIF format detected, we will use the artifact's cid as the thumbnail to avoid uploading twice" ) thumbnailUri = `${uri}` if (thumbnail?.format) {