Skip to content

Commit

Permalink
Fixed bug loading IPFS NFT profile image on original files
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro committed Mar 10, 2022
1 parent 731e504 commit f535a5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/utils/uriToHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function uriToHttp(uri: string): string[] {
case 'http':
return ['https' + uri.substr(4), uri]
case 'ipfs':
const hash = uri.match(/^ipfs:(\/\/)?(.*)$/i)?.[2]
const hash = uri.match(/^ipfs:(\/\/)?(ipfs\/)?(.*)$/i)?.[3] // TODO: probably a bug on original code
return [`https://cloudflare-ipfs.com/ipfs/${hash}/`, `https://ipfs.io/ipfs/${hash}/`]
case 'ipns':
const name = uri.match(/^ipns:(\/\/)?(.*)$/i)?.[2]
Expand Down

0 comments on commit f535a5b

Please sign in to comment.