Skip to content

Commit 270b39a

Browse files
committed
Reject invalid URIs in fs: handler
- closes #83
1 parent e7aae17 commit 270b39a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/protocols.js

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ CommonProtocolHandler.prototype = Object.freeze({
118118
channel = ioservice.newChannelFromURI(httpUri)
119119
}
120120

121+
// fs: handler should reject non-ipfs URIs
122+
if (!isIPFS.url(httpUri.spec)) {
123+
channel.cancel(Cr.NS_ERROR_MALFORMED_URI)
124+
return channel
125+
}
126+
121127
if (gw.fsUris && this.scheme === FS_SCHEME) {
122128
channel.originalURI = aURI
123129
channel.loadFlags &= ~Ci.nsIChannel.LOAD_REPLACE

0 commit comments

Comments
 (0)