Skip to content

Commit

Permalink
fix: broken URIs starting with ipfs://ipfs
Browse files Browse the repository at this point in the history
This ensures we dont contribute to problem described in:
ipfs/kubo#7930
  • Loading branch information
lidel committed Mar 19, 2021
1 parent 1b08e0c commit d822923
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/minty.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,15 @@ class Minty {
}

function ensureIpfsUriPrefix(cidOrURI) {
if (!cidOrURI.toString().startsWith('ipfs://')) {
return 'ipfs://' + cidOrURI
let uri = cidOrURI.toString()
if (!uri.startsWith('ipfs://')) {
uri = 'ipfs://' + cidOrURI
}
return cidOrURI.toString()
// Avoid the Nyan Cat bug (https://github.com/ipfs/go-ipfs/pull/7930)
if (uri.startsWith('ipfs://ipfs/')) {
uri = uri.replace('ipfs://ipfs/', 'ipfs://')
}
return uri
}

/**
Expand Down

0 comments on commit d822923

Please sign in to comment.