allow APPEND string args as Buffers

This commit is contained in:
Andris Reinman 2018-12-29 01:09:26 +02:00
parent 496104d936
commit 05c79b680f

View file

@ -40,7 +40,13 @@ module.exports = {
});
}
let path = Buffer.from((command.attributes.shift() || {}).value || 'binary').toString();
let path = (command.attributes.shift() || {}).value;
if (!Buffer.isBuffer(path)) {
path = path.toString();
} else {
path = Buffer.from(path, 'binary').toString();
}
path = imapTools.normalizeMailbox(path, !this.acceptUTF8Enabled);
let message = command.attributes.pop();
let flags = [];
@ -69,6 +75,8 @@ module.exports = {
}
if (internaldate) {
internaldate = internaldate.toString(); // might be Buffer
if (!validateInternalDate(internaldate)) {
return callback(new Error('Invalid date argument for APPEND'));
}