diff --git a/imap-core/lib/commands/copy.js b/imap-core/lib/commands/copy.js index e753d21e..2d99d585 100644 --- a/imap-core/lib/commands/copy.js +++ b/imap-core/lib/commands/copy.js @@ -35,7 +35,7 @@ module.exports = { return callback(new Error('Invalid mailbox argument for ' + cmd)); } - if (!imapTools.validateSequnce(range)) { + if (!imapTools.validateSequence(range)) { return callback(new Error('Invalid sequence set for ' + cmd)); } diff --git a/imap-core/lib/commands/fetch.js b/imap-core/lib/commands/fetch.js index fbc21972..2e34fe3f 100644 --- a/imap-core/lib/commands/fetch.js +++ b/imap-core/lib/commands/fetch.js @@ -43,7 +43,7 @@ module.exports = { let isUid = (command.command || '').toString().toUpperCase() === 'UID FETCH' ? true : false; let range = (command.attributes[0] && command.attributes[0].value) || ''; - if (!imapTools.validateSequnce(range)) { + if (!imapTools.validateSequence(range)) { return callback(new Error('Invalid sequence set for ' + command.command)); } let messages = imapTools.getMessageRange(this.selected.uidList, range, isUid); diff --git a/imap-core/lib/commands/move.js b/imap-core/lib/commands/move.js index e2719533..e30b89c8 100644 --- a/imap-core/lib/commands/move.js +++ b/imap-core/lib/commands/move.js @@ -35,7 +35,7 @@ module.exports = { return callback(new Error('Invalid mailbox argument for ' + cmd)); } - if (!imapTools.validateSequnce(range)) { + if (!imapTools.validateSequence(range)) { return callback(new Error('Invalid sequence set for ' + cmd)); } diff --git a/imap-core/lib/commands/search.js b/imap-core/lib/commands/search.js index fb71cb0f..8c672490 100644 --- a/imap-core/lib/commands/search.js +++ b/imap-core/lib/commands/search.js @@ -167,7 +167,7 @@ function parseQueryTerms(terms, uidList) { if (!termType) { // try if it is a sequence set - if (imapTools.validateSequnce(term)) { + if (imapTools.validateSequence(term)) { // resolve sequence list to an array of UID values curTerm = ['uid', imapTools.getMessageRange(uidList, term, false)]; } else { @@ -179,7 +179,7 @@ function parseQueryTerms(terms, uidList) { if (termType[i] === 'expression') { curTerm.push(getTerm(level + 1)); } else if (termType[i] === 'sequence') { - if (!imapTools.validateSequnce(terms[pos])) { + if (!imapTools.validateSequence(terms[pos])) { throw new Error('Invalid sequence set for ' + term.toUpperCase()); } // resolve sequence list to an array of UID values diff --git a/imap-core/lib/commands/store.js b/imap-core/lib/commands/store.js index 2e7daa72..bb6426be 100644 --- a/imap-core/lib/commands/store.js +++ b/imap-core/lib/commands/store.js @@ -75,7 +75,7 @@ module.exports = { silent = true; } - if (!imapTools.validateSequnce(range)) { + if (!imapTools.validateSequence(range)) { return callback(new Error('Invalid sequence set for STORE')); } diff --git a/imap-core/lib/commands/uid-expunge.js b/imap-core/lib/commands/uid-expunge.js index d0bc4fa2..bb0f4e03 100644 --- a/imap-core/lib/commands/uid-expunge.js +++ b/imap-core/lib/commands/uid-expunge.js @@ -29,7 +29,7 @@ module.exports = { } let range = (command.attributes[0] && command.attributes[0].value) || ''; - if (!imapTools.validateSequnce(range)) { + if (!imapTools.validateSequence(range)) { return callback(new Error('Invalid sequence set for UID EXPUNGE')); } let messages = imapTools.getMessageRange(this.selected.uidList, range, true); diff --git a/imap-core/lib/commands/uid-store.js b/imap-core/lib/commands/uid-store.js index c52f3d08..a946fb60 100644 --- a/imap-core/lib/commands/uid-store.js +++ b/imap-core/lib/commands/uid-store.js @@ -65,7 +65,7 @@ module.exports = { silent = true; } - if (!imapTools.validateSequnce(range)) { + if (!imapTools.validateSequence(range)) { return callback(new Error('Invalid sequence set for UID STORE')); } diff --git a/imap-core/lib/imap-tools.js b/imap-core/lib/imap-tools.js index 017b9070..5eb5daf9 100644 --- a/imap-core/lib/imap-tools.js +++ b/imap-core/lib/imap-tools.js @@ -201,7 +201,7 @@ module.exports.searchMapping = { * @param {range} range Sequence range, eg "1,2,3:7" * @returns {Boolean} True if the string looks like a sequence range */ -module.exports.validateSequnce = function (range) { +module.exports.validateSequence = function (range) { return !!(range.length && /^(\d+|\*)(:\d+|:\*)?(,(\d+|\*)(:\d+|:\*)?)*$/.test(range)); };