Skip to content

Commit

Permalink
Allow only ipfs:/ or ipfs://
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Mar 9, 2017
1 parent 4f0bed8 commit a7a4838
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a7a4838

Please sign in to comment.