Skip to content

Commit

Permalink
fix(imap): Fixed issue with a single + response
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Nov 7, 2024
1 parent 6babc7a commit 51be3a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/handler/imap-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = async (command, options) => {
response.tag = await parser.getTag();

await parser.getSpace();

response.command = await parser.getCommand();

if (nullBytesRemoved) {
Expand Down
5 changes: 5 additions & 0 deletions lib/handler/parser-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ class ParserInstance {

async getSpace() {
if (!this.remainder.length) {
if (this.tag === '+' && this.pos === 1) {
// special case, empty + response
return;
}

let error = new Error(`Unexpected end of input at position ${this.pos} [E4]`);
error.code = 'ParserError4';
error.parserContext = { input: this.input, pos: this.pos };
Expand Down

0 comments on commit 51be3a9

Please sign in to comment.