Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
12 changes: 10 additions & 2 deletions lib/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var MAX_INT = 9007199254740992,
RE_BACKSLASH = /\\/g,
RE_DBLQUOTE = /"/g,
RE_ESCAPE = /\\\\/g,
RE_INTEGER = /^\d+$/;
RE_INTEGER = /^\d+$/,
RE_PARTIAL_BODY = /^(TEXT)(<[0-9]+\.[0-9]+>)$/;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that partial fetches are limited strictly to TEXT.


function Connection(config) {
if (!(this instanceof Connection))
Expand Down Expand Up @@ -820,8 +821,15 @@ Connection.prototype._fetch = function(which, uids, options) {
if (!Array.isArray(bodies))
bodies = [bodies];
for (i = 0, len = bodies.length; i < len; ++i) {
var suffix = '';
var parts = bodies[i].match(RE_PARTIAL_BODY);
if (parts) {
suffix = parts[2];
bodies[i] = parts[1];
}

fetching.push(parseExpr(''+bodies[i]));
cmd += ' BODY' + prefix + '[' + bodies[i] + ']';
cmd += ' BODY' + prefix + '[' + bodies[i] + ']' + suffix;
}
}
} else
Expand Down