aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-02-20 22:25:35 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-02-20 22:25:35 -0500
commita48b542363b582519083db1537bef7c776efa174 (patch)
tree99d0a8a99d3bca63a4788c2a5f1d18c3b70897ad /lib/serve.js
parent206f10486251d32a41f31419de77ce12033d5ba5 (diff)
downloadpatchfoo-a48b542363b582519083db1537bef7c776efa174.tar.gz
patchfoo-a48b542363b582519083db1537bef7c776efa174.zip
Set suggested filename for blob download
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index d739659..5386cbc 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -486,6 +486,8 @@ Serve.prototype.blob = function (id) {
else return self.respond(500, err.message || err)
}
if (!has) return self.respond(404, 'Not found')
+ if (self.query.name) self.res.setHeader('Content-Disposition',
+ 'inline; filename='+encodeURIComponent(self.query.name))
pull(
blobs.get(id),
pull.map(Buffer),