Commit fb32aba68ca6fa8bb5c6aa03f81d9f3cc71a50d4
indent
cel committed on 2/5/2019, 8:57:16 AMParent: 06f263c1100b77af62177e4b11348b6b4574caae
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -27,21 +27,19 @@ | |||
27 | 27 … | try { | |
28 | 28 … | var module = require(resolved) | |
29 | 29 … | return cb(null, module) | |
30 | 30 … | } catch(e) { | |
31 | - if (!tried && e && (e.code === 'ENOENT' || e.code === 'MODULE_NOT_FOUND')) { | ||
32 | - var m = /(sha256)\/([0-9a-f]{2})\/([0-9a-f]{62})/.exec(e.path || e.message) | ||
33 | - if (!m) return cb(e) | ||
34 | - var blobId = '&' + new Buffer(m[2] + m[3], 'hex').toString('base64') + '.' + m[1] | ||
35 | - if (!sbot.blobs) return cb(new Error('Missing ssb-blobs plugin')) | ||
36 | - if (typeof sbot.blobs.want !== 'function') return cb(new Error('missing blobs.want method')) | ||
37 | - return sbot.blobs.want(blobId, function (err, has) { | ||
38 | - if (err) return cb(new Error('Unable to get blob: ' + (err.stack || err))) | ||
39 | - if (!has) return cb(new Error('Unable to get blob')) | ||
40 | - getModule(resolved, true, cb) | ||
41 | - }) | ||
42 | - } | ||
43 | - return cb(e) | ||
31 … | + if (tried || !e || !(e.code === 'ENOENT' || e.code === 'MODULE_NOT_FOUND')) return cb(e) | ||
32 … | + var m = /(sha256)\/([0-9a-f]{2})\/([0-9a-f]{62})/.exec(e.path || e.message) | ||
33 … | + if (!m) return cb(e) | ||
34 … | + var blobId = '&' + new Buffer(m[2] + m[3], 'hex').toString('base64') + '.' + m[1] | ||
35 … | + if (!sbot.blobs) return cb(new Error('Missing ssb-blobs plugin')) | ||
36 … | + if (typeof sbot.blobs.want !== 'function') return cb(new Error('missing blobs.want method')) | ||
37 … | + return sbot.blobs.want(blobId, function (err, has) { | ||
38 … | + if (err) return cb(new Error('Unable to get blob: ' + (err.stack || err))) | ||
39 … | + if (!has) return cb(new Error('Unable to get blob')) | ||
40 … | + getModule(resolved, true, cb) | ||
41 … | + }) | ||
44 | 42 … | } | |
45 | 43 … | } | |
46 | 44 … | ||
47 | 45 … | sbot.ws.use(function (req, res, next) { |
Built with git-ssb-web