aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Whitmore <sww@eight45.net>2018-03-29 05:55:34 +0000
committerStephen Whitmore <sww@eight45.net>2018-03-29 05:55:34 +0000
commita5a30a77b04006babcb954049b69209d25743830 (patch)
treea5cd3bd5fbb889f9923e7dd002345026b1cc2eb2
parentc0b22799da2d39c7224fd51537b5216cd078355c (diff)
downloadpatchfoo-a5a30a77b04006babcb954049b69209d25743830.tar.gz
patchfoo-a5a30a77b04006babcb954049b69209d25743830.zip
fix: detect empty attachments on private msgs
-rw-r--r--lib/serve.js7
1 files changed, 6 insertions, 1 deletions
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)