diff --git a/lib/gateways.js b/lib/gateways.js index e65241743..3f1a9fb3f 100644 --- a/lib/gateways.js +++ b/lib/gateways.js @@ -5,6 +5,8 @@ const {Cc, Ci} = require('chrome') const prefs = require('sdk/simple-prefs').prefs const ioservice = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService) +// TODO: replace regex with 3rd party library provided by IPFS community +// Ref. https://github.com/ipfs/notes/issues/92#issuecomment-172135885 const IPFS_RESOURCE = /^https?:\/\/[^\/]+\/ip(f|n)s\// exports.IPFS_RESOURCE = IPFS_RESOURCE diff --git a/lib/protocols.js b/lib/protocols.js index 93735fe8d..931803591 100644 --- a/lib/protocols.js +++ b/lib/protocols.js @@ -10,7 +10,9 @@ const IPNS_SCHEME = 'ipns' const FS_SCHEME = 'fs' const WEB_SCHEME_PREFIX = 'web+' // https://github.com/lidel/ipfs-firefox-addon/issues/36 -const IPFS_PATH = new RegExp('^/ip(f|n)s/') +// TODO: replace regex with 3rd party library provided by IPFS community +// Ref. https://github.com/ipfs/notes/issues/92#issuecomment-172135885 +const IPFS_PATH = new RegExp('^/(ipns/|ipfs/Qm[1-9A-HJ-NP-Za-km-z]{44})') function CommonProtocolHandler () {}