Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/core/classes/ipfs-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<string, any>,
Expand Down
6 changes: 4 additions & 2 deletions src/core/helpers/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down