diff --git a/package.json b/package.json index 987f6a2b2..81cfb391b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thirdweb-dev/sdk", - "version": "2.3.8", + "version": "2.3.9-0", "description": "The main thirdweb SDK.", "repository": { "type": "git", diff --git a/src/core/classes/ipfs-storage.ts b/src/core/classes/ipfs-storage.ts index 1163b59ef..a003a59fb 100644 --- a/src/core/classes/ipfs-storage.ts +++ b/src/core/classes/ipfs-storage.ts @@ -214,7 +214,7 @@ export class IpfsStorage implements IStorage { }, ) { // replace all active gateway url links with their raw ipfs hash - const sanitizedMetadatas = await replaceGatewayUrlWithHash( + const sanitizedMetadatas = replaceGatewayUrlWithHash( metadatas, "ipfs://", this.gatewayUrl, @@ -278,9 +278,9 @@ export class IpfsStorage implements IStorage { /** * FOR TESTING ONLY * @internal - * @param data - * @param contractAddress - * @param signerAddress + * @param data - + * @param contractAddress - + * @param signerAddress - */ public async uploadSingle( data: string | Record, diff --git a/src/core/helpers/storage.ts b/src/core/helpers/storage.ts index fd0cd01c9..bc88cfe5d 100644 --- a/src/core/helpers/storage.ts +++ b/src/core/helpers/storage.ts @@ -91,14 +91,16 @@ export function replaceGatewayUrlWithHash( object[keys[key]] = toIPFSHash(val, scheme, gatewayUrl); if (Array.isArray(val)) { object[keys[key]] = val.map((el) => { - if (typeof el === "object") { + const isFile = el instanceof File || el instanceof Buffer; + if (typeof el === "object" && !isFile) { return replaceGatewayUrlWithHash(el, scheme, gatewayUrl); } else { return toIPFSHash(el, scheme, gatewayUrl); } }); } - if (typeof val === "object") { + const isFile = val instanceof File || val instanceof Buffer; + if (typeof val === "object" && !isFile) { replaceGatewayUrlWithHash(val, scheme, gatewayUrl); } }