Skip to content

Commit

Permalink
fix: Repair patchIPFSUtlsIfApplication to only replace if the URL sta…
Browse files Browse the repository at this point in the history
…rts with ipfs://
  • Loading branch information
richtera committed Sep 17, 2024
1 parent f5402b8 commit 27da039
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ export function patchIPFSUrlsIfApplicable(
receivedData: URLDataWithHash,
ipfsGateway: string,
): URLDataWithHash {
if (receivedData?.url?.indexOf('ipfs://') !== -1) {
// Only map URL if it's indeed an ipfs:// URL and ignore if it's a data:// URL with JSON
// possibly containing an IPFS URL inside of the JSON data.
if (receivedData?.url?.startsWith('ipfs://')) {
return {
...receivedData,
url: receivedData.url.replace('ipfs://', ipfsGateway),
Expand Down

0 comments on commit 27da039

Please sign in to comment.