diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..0094556 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 16.14.2 diff --git a/src/lib/helpers/uploader.helper.ts b/src/lib/helpers/uploader.helper.ts index d039512..d9ff2e9 100644 --- a/src/lib/helpers/uploader.helper.ts +++ b/src/lib/helpers/uploader.helper.ts @@ -191,11 +191,14 @@ export function formatIPFSUrl(ipfsGateway: IPFSGateway, ipfsHash: string) { ipfsUrl = ipfsGateway.endsWith('/') ? `${ipfsGateway}${ipfsHash}` : `${ipfsGateway}/${ipfsHash}`; + } else if ( + ipfsGateway.url && + (typeof ipfsGateway.url === 'string' || ipfsGateway.url instanceof URL) + ) { + const url = new URL(ipfsGateway.url); + ipfsUrl = new URL(`/ipfs/${ipfsHash}`, url).toString(); } else { - const protocol = ipfsGateway?.host ?? 'https'; - const host = ipfsGateway?.host ?? '2eff.lukso.dev'; - - ipfsUrl = `${[protocol]}://${host}/ipfs/${ipfsHash}`; + throw new Error('IPFS gateway as Multiaddr is currently not supported'); } return ipfsUrl;