From 6f04462393dc718d7d49780bd88c5fbd0aa98d72 Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 30 May 2017 15:12:30 -1000 Subject: Fix handling multiple uploads --- lib/serve.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/serve.js') diff --git a/lib/serve.js b/lib/serve.js index e0d9396..9d6f0b8 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -1945,9 +1945,8 @@ Serve.prototype.composer = function (opts, cb) { var formEmojiNames = {} var emojiIds = u.toArray(data.emoji_id) var emojiNames = u.toArray(data.emoji_name) - var emojiUploads = u.toArray(data.emoji_upload) for (var i = 0; i < emojiIds.length && i < emojiNames.length; i++) { - var upload = emojiUploads[i] + var upload = data['emoji_upload_' + i] formEmojiNames[emojiNames[i]] = (upload && upload.link) || u.extractBlobIds(emojiIds[i])[0] if (upload) blobs[upload.link] = { @@ -2043,14 +2042,14 @@ Serve.prototype.composer = function (opts, cb) { ] : '', emoji.length > 0 ? [ h('div', h('em', 'emoji:')), - h('ul.mentions', emoji.map(function (link) { + h('ul.mentions', emoji.map(function (link, i) { return h('li', h('code', link.name), ': ', h('input', {name: 'emoji_name', type: 'hidden', value: link.name}), h('input.id-input', {name: 'emoji_id', size: 60, value: link.id, placeholder: '&id'}), ' ', - h('input', {type: 'file', name: 'emoji_upload'})) + h('input', {type: 'file', name: 'emoji_upload_' + i})) })) ] : '', h('table.ssb-msgs', -- cgit v1.2.3