From a73918fe22e481b5f44479740dd3d5910970bf6f Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 1 May 2019 16:51:09 -1000 Subject: Handle boxed markdown blobs --- lib/serve.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/serve.js') 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))) -- cgit v1.2.3