aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js9
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)))