fetch() should check for a blank uids argument

fork
Brian White 14 years ago
parent 3b61bca20c
commit e17d21f6f1

@ -523,6 +523,10 @@ ImapConnection.prototype.search = function(options, cb) {
ImapConnection.prototype.fetch = function(uids, options) { ImapConnection.prototype.fetch = function(uids, options) {
if (this._state.status !== STATES.BOXSELECTED) if (this._state.status !== STATES.BOXSELECTED)
throw new Error('No mailbox is currently selected'); throw new Error('No mailbox is currently selected');
if (typeof uids === undefined || typeof uids === null
|| (Array.isArray(uids) && uids.length === 0))
throw new Error('Nothing to fetch');
if (!Array.isArray(uids)) if (!Array.isArray(uids))
uids = [uids]; uids = [uids];
try { try {
@ -530,6 +534,7 @@ ImapConnection.prototype.fetch = function(uids, options) {
} catch(e) { } catch(e) {
throw e; throw e;
} }
var defaults = { var defaults = {
markSeen: false, markSeen: false,
request: { request: {

Loading…
Cancel
Save