Check for prepended backslashes in user-supplied flags

fork
Brian White 12 years ago
parent 321387c0e6
commit 737b2de8b8

@ -1157,10 +1157,13 @@ ImapConnection.prototype._store = function(which, uids, flags, isAdding, cb) {
flags = [flags];
for (var i=0; i<flags.length; i++) {
if (!isKeywords) {
if (flags[i][0] === '\\')
flags[i] = flags[i].substr(1);
if (this._state.box.permFlags.indexOf(flags[i]) === -1
|| flags[i] === '\\*' || flags[i] === '*')
|| flags[i] === '*')
throw new Error('The flag "' + flags[i]
+ '" is not allowed by the server for this mailbox');
flags[i] = '\\' + flags[i];
} else {
// keyword contains any char except control characters (%x00-1F and %x7F)
// and: '(', ')', '{', ' ', '%', '*', '\', '"', ']'
@ -1170,8 +1173,6 @@ ImapConnection.prototype._store = function(which, uids, flags, isAdding, cb) {
}
}
}
if (!isKeywords)
flags = flags.map(function(flag) {return '\\' + flag;});
flags = flags.join(' ');
cb = arguments[arguments.length-1];

Loading…
Cancel
Save