Commit a7a48382 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Allow only ipfs:/ or ipfs://

parent 4f0bed8e
...@@ -532,7 +532,7 @@ var run = function () { ...@@ -532,7 +532,7 @@ var run = function () {
function handleIPFS (url, cb) { function handleIPFS (url, cb) {
// replace ipfs:// with /ipfs/ // replace ipfs:// with /ipfs/
url = url.replace(/^ipfs:\/\/?/, '/ipfs/') url = url.replace(/^ipfs:\/\/?/, 'ipfs/')
$('#output').append($('<div/>').append($('<pre/>').text('Loading ' + url + ' ...'))) $('#output').append($('<div/>').append($('<pre/>').text('Loading ' + url + ' ...')))
return $.get('https://gateway.ipfs.io/' + url) return $.get('https://gateway.ipfs.io/' + url)
...@@ -573,7 +573,7 @@ var run = function () { ...@@ -573,7 +573,7 @@ var run = function () {
files.addReadOnly(url, content) files.addReadOnly(url, content)
cb(null, content) cb(null, content)
}) })
} else if ((match = /^(\/?ipfs:?\/\/?.+)/.exec(url))) { } else if ((match = /^(ipfs:\/\/?.+)/.exec(url))) {
handleIPFS(match[1], function (err, content) { handleIPFS(match[1], function (err, content) {
if (err) { if (err) {
cb('Unable to import "' + url + '": ' + err) cb('Unable to import "' + url + '": ' + err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment