Allow only ipfs:/ or ipfs://

pull/1/head
Alex Beregszaszi 8 years ago
parent 4f0bed8e90
commit a7a483824a
  1. 4
      src/app.js

@ -532,7 +532,7 @@ var run = function () {
function handleIPFS (url, cb) {
// replace ipfs:// with /ipfs/
url = url.replace(/^ipfs:\/\/?/, '/ipfs/')
url = url.replace(/^ipfs:\/\/?/, 'ipfs/')
$('#output').append($('<div/>').append($('<pre/>').text('Loading ' + url + ' ...')))
return $.get('https://gateway.ipfs.io/' + url)
@ -573,7 +573,7 @@ var run = function () {
files.addReadOnly(url, content)
cb(null, content)
})
} else if ((match = /^(\/?ipfs:?\/\/?.+)/.exec(url))) {
} else if ((match = /^(ipfs:\/\/?.+)/.exec(url))) {
handleIPFS(match[1], function (err, content) {
if (err) {
cb('Unable to import "' + url + '": ' + err)

Loading…
Cancel
Save