Skip to content

Commit

Permalink
fix: Repair patchIPFSUrlsIfApplicable to only map urls starting with …
Browse files Browse the repository at this point in the history
…ipfs://
  • Loading branch information
richtera committed Sep 17, 2024
1 parent 1f0e740 commit 3fe394d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erc725/erc725.js",
"version": "0.27.2",
"version": "0.27.3",
"description": "Library to interact with ERC725 smart contracts",
"main": "build/main/src/index.js",
"typings": "build/main/src/index.d.ts",
Expand Down
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 3fe394d

Please sign in to comment.