wildduck
wildduck copied to clipboard
Bug: `tools.checkRangeQuery` does not consider edge case of `update.messages.length === 0`
As you can see from code snippet below , if the case is that update.messages.length
is 0
, then an invalid query object will be returned. This namely happens for queryAll
cases (e.g. 1:*
) for COPY
.
https://github.com/nodemailer/wildduck/blob/c9188b3766b547b091d140a33308b5c3ec3aa1d4/lib/handlers/on-copy.js#L66-L73
> const tools = require('wildduck/lib/tools')
undefined
> tools.checkRangeQuery([], false)
{ '$gte': undefined, '$lte': undefined }
> tools.checkRangeQuery([], true)
{ '$not': { '$gte': undefined, '$lte': undefined } }