Unverified Commit eb2fafab authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1119 from ethereum/fixSwarmRetrieval

Extract swarm hash from bzz url
parents 69fc301f e2fab54b
...@@ -28,9 +28,9 @@ module.exports = { ...@@ -28,9 +28,9 @@ module.exports = {
}) })
}, },
handleSwarmImport: function (url, cb) { handleSwarmImport: function (url, cleanUrl, cb) {
swarmgw.get(url, function (err, content) { swarmgw.get(url, function (err, content) {
cb(err, content, url) cb(err, content, cleanUrl)
}) })
}, },
...@@ -56,7 +56,7 @@ module.exports = { ...@@ -56,7 +56,7 @@ module.exports = {
handlers: function () { handlers: function () {
return [ return [
{ type: 'github', match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)\/(.*)/, handler: (match, cb) => { this.handleGithubCall(match[3], match[4], cb) } }, { 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) } } { type: 'ipfs', match: /^(ipfs:\/\/?.+)/, handler: (match, cb) => { this.handleIPFS(match[1], cb) } }
] ]
}, },
......
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