From bf9984f063168d1e25024edd567f2dbaf0a7f747 Mon Sep 17 00:00:00 2001 From: Dominik Gehl Date: Wed, 2 Oct 2013 14:11:10 -0400 Subject: [PATCH] allow flags with backslash in append https://github.com/mscdex/node-imap/issues/186 --- lib/Connection.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index f33ef4b..4b2cd5c 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -259,8 +259,13 @@ Connection.prototype.append = function(data, options, cb) { if (options.flags) { if (!Array.isArray(options.flags)) options.flags = [options.flags]; - if (options.flags.length > 0) - cmd += ' (\\' + options.flags.join(' \\') + ')'; + if (options.flags.length > 0) { + for (var i = 0, len = options.flags.length; i < len; ++i) { + if (options.flags[i][0] !== '\\') + options.flags[i] = '\\' + options.flags[i]; + } + cmd += ' (' + options.flags.join(' ') + ')'; + } } if (options.date) { if (!isDate(options.date))