Skip to content

Commit

Permalink
IPFS protocol: make the ipfs/ prefix optional (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpierre authored May 14, 2021
1 parent bea125f commit 151924f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function ipfsUrlDefault(cid: string, path = ""): string {
return `https://ipfs.io/ipfs/${cid}${path}`
}

const IPFS_PROTOCOL_RE = /^ipfs:\/\/ipfs\/([^/]+)(\/.+)?$/
const IPFS_PROTOCOL_RE = /^ipfs:\/\/(?:ipfs\/)?([^/]+)(\/.+)?$/
const IPFS_HASH_RE = /^Qm[1-9A-HJ-NP-Za-km-z]{44}$/

export function ipfsUrl(
Expand Down

0 comments on commit 151924f

Please sign in to comment.