Skip to content

Commit f696599

Browse files
committed
FIX for false-positive href rewrites
- Closes #43
1 parent 701443c commit f696599

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/gateways.js

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const {Cc, Ci} = require('chrome')
55
const prefs = require('sdk/simple-prefs').prefs
66
const ioservice = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService)
77

8+
// TODO: replace regex with 3rd party library provided by IPFS community
9+
// Ref. https://github.com/ipfs/notes/issues/92#issuecomment-172135885
810
const IPFS_RESOURCE = /^https?:\/\/[^\/]+\/ip(f|n)s\//
911

1012
exports.IPFS_RESOURCE = IPFS_RESOURCE

lib/protocols.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const IPNS_SCHEME = 'ipns'
1010
const FS_SCHEME = 'fs'
1111
const WEB_SCHEME_PREFIX = 'web+' // https://github.com/lidel/ipfs-firefox-addon/issues/36
1212

13-
const IPFS_PATH = new RegExp('^/ip(f|n)s/')
13+
// TODO: replace regex with 3rd party library provided by IPFS community
14+
// Ref. https://github.com/ipfs/notes/issues/92#issuecomment-172135885
15+
const IPFS_PATH = new RegExp('^/(ipns/|ipfs/Qm[1-9A-HJ-NP-Za-km-z]{44})')
1416

1517
function CommonProtocolHandler () {}
1618

0 commit comments

Comments
 (0)