From a61279f373c90d3fdfcab9b1452ea274699b2289 Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 6 May 2020 11:43:54 -0400 Subject: Handle want private blobs for markdown view --- lib/serve.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/serve.js') diff --git a/lib/serve.js b/lib/serve.js index 414cef5..7d686a4 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -382,10 +382,15 @@ Serve.prototype.publishAttend = function (cb) { this.publish(content, cb) } +function removeQuery(ref) { + return ref.replace(/\?.*/, '') +} + Serve.prototype.wantBlobs = function (cb) { var self = this if (!self.data.blob_ids) return cb() var ids = self.data.blob_ids.split(',') + .map(removeQuery) if (!ids.every(u.isRef)) return cb(new Error('bad blob ids ' + ids.join(','))) var done = multicb({pluck: 1}) ids.forEach(function (id) { @@ -4031,7 +4036,8 @@ Serve.prototype.askWantBlobsForm = function (links) { ph('h3', 'Missing blobs'), ph('p', 'The application needs these blobs to continue:'), ph('table', links.map(u.toLink).filter(uniqueLink()).map(function (link) { - if (!u.isRef(link.link)) return + var id = removeQuery(link.link) + if (!u.isRef(id)) return return ph('tr', [ ph('td', ph('code', link.link)), !isNaN(link.size) ? ph('td', self.app.render.formatSize(link.size)) : '', -- cgit v1.2.3