From e17d21f6f1999deeaf64455e5f7f7da72d77b271 Mon Sep 17 00:00:00 2001 From: Brian White Date: Mon, 18 Apr 2011 10:07:27 -0400 Subject: [PATCH] fetch() should check for a blank uids argument --- imap.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/imap.js b/imap.js index e0f5b2d..588a243 100644 --- a/imap.js +++ b/imap.js @@ -523,6 +523,10 @@ ImapConnection.prototype.search = function(options, cb) { ImapConnection.prototype.fetch = function(uids, options) { if (this._state.status !== STATES.BOXSELECTED) 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)) uids = [uids]; try { @@ -530,6 +534,7 @@ ImapConnection.prototype.fetch = function(uids, options) { } catch(e) { throw e; } + var defaults = { markSeen: false, request: {