fixed broken SEARCH UID response

This commit is contained in:
Andris Reinman 2021-04-27 13:10:08 +03:00
parent d1420bc74b
commit 7a4e9514ef

View file

@ -29,7 +29,11 @@ module.exports = server => (mailbox, options, session, callback) => {
mailbox: mailboxData._id
};
let returned = false;
let walkQuery = (parent, ne, node) => {
if (returned) {
return;
}
node.forEach(term => {
switch (term.key) {
case 'all':
@ -92,6 +96,7 @@ module.exports = server => (mailbox, options, session, callback) => {
if (Array.isArray(term.value)) {
if (!term.value.length) {
// trying to find a message that does not exist
returned = true;
return callback(null, {
uidList: [],
highestModseq: 0
@ -324,6 +329,10 @@ module.exports = server => (mailbox, options, session, callback) => {
let $and = [];
walkQuery($and, false, options.query);
if (returned) {
return;
}
if ($and.length) {
query.$and = $and;
}