From a5a30a77b04006babcb954049b69209d25743830 Mon Sep 17 00:00:00 2001 From: Stephen Whitmore Date: Thu, 29 Mar 2018 05:55:34 +0000 Subject: fix: detect empty attachments on private msgs --- lib/serve.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/serve.js b/lib/serve.js index 1bf2196..004079b 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -107,11 +107,16 @@ Serve.prototype.go = function () { } busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { var cb = filesCb() + var size = 0 pull( toPull(file), + pull.map(function (data) { + size += data.length + return data + }), self.app.addBlob(!!data.private, function (err, link) { if (err) return cb(err) - if (link.size === 0 && !filename) return cb() + if (size === 0 && !filename) return cb() link.name = filename link.type = mimetype addField(fieldname, link) -- cgit v1.2.3