diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-05-01 16:51:09 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-05-01 16:51:09 -1000 |
commit | a73918fe22e481b5f44479740dd3d5910970bf6f (patch) | |
tree | 692933b5f1f5a6167f8cc45b03e06b9abea62a21 /lib/serve.js | |
parent | 7750ee481b305ff8789ca9813da2c62182b25b06 (diff) | |
download | patchfoo-a73918fe22e481b5f44479740dd3d5910970bf6f.tar.gz patchfoo-a73918fe22e481b5f44479740dd3d5910970bf6f.zip |
Handle boxed markdown blobs
Diffstat (limited to 'lib/serve.js')
-rw-r--r-- | lib/serve.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/serve.js b/lib/serve.js index c2f7cca..d8be4fc 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -3028,16 +3028,17 @@ Serve.prototype.npmRegistry = function (url) { Serve.prototype.markdown = function (url) { var self = this var id = decodeURIComponent(url.substr(1)) - var blobs = self.app.sbot.blobs + if (typeof self.query.unbox === 'string') id += '?unbox=' + self.query.unbox.replace(/\s/g, '+') return pull( ph('section', {}, [ ph('h3', [ ph('a', {href: '/links/' + id}, id.substr(0, 8) + '…') ]), u.readNext(function (cb) { - blobs.size(id, function (err, size) { - if (size == null) return cb(null, self.askWantBlobsForm([id])) - pull(blobs.get(id), pull.collect(function (err, chunks) { + self.app.getHasBlob(id, function (err, has) { + if (err) return cb(err) + if (!has) return cb(null, self.askWantBlobsForm([id])) + pull(self.app.getBlob(id), pull.collect(function (err, chunks) { if (err) return cb(null, ph('div', u.renderError(err).outerHTML)) var text = Buffer.concat(chunks).toString() cb(null, ph('blockquote', self.app.render.markdown(text))) |