From a168813432c44426b7748c801b5ecd1a8017a950 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 26 Feb 2018 16:58:36 +0100 Subject: [PATCH] extract swarm hash --- src/app/compiler/compiler-imports.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/compiler/compiler-imports.js b/src/app/compiler/compiler-imports.js index 3a09141907..8860beb161 100644 --- a/src/app/compiler/compiler-imports.js +++ b/src/app/compiler/compiler-imports.js @@ -28,9 +28,9 @@ module.exports = { }) }, - handleSwarmImport: function (url, cb) { + handleSwarmImport: function (url, cleanUrl, cb) { swarmgw.get(url, function (err, content) { - cb(err, content, url) + cb(err, content, cleanUrl) }) }, @@ -56,7 +56,7 @@ module.exports = { handlers: function () { return [ { type: 'github', match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)\/(.*)/, handler: (match, cb) => { this.handleGithubCall(match[3], match[4], cb) } }, - { type: 'swarm', match: /^(bzz[ri]?:\/\/?.*)$/, handler: (match, cb) => { this.handleSwarmImport(match[1], cb) } }, + { type: 'swarm', match: /^(bzz[ri]?:\/\/?(.*))$/, handler: (match, cb) => { this.handleSwarmImport(match[1], match[2], cb) } }, { type: 'ipfs', match: /^(ipfs:\/\/?.+)/, handler: (match, cb) => { this.handleIPFS(match[1], cb) } } ] },