Skip to content

Commit

Permalink
fix(idle): Fixed IDLE bug with Outlook
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 10, 2024
1 parent 1354bf0 commit f2c8545
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
15 changes: 15 additions & 0 deletions imap-core/lib/imap-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ class IMAPCommand {
if (command.expecting > maxAllowed) {
// APPENDLIMIT response for too large messages
// TOOBIG: https://tools.ietf.org/html/rfc4469#section-4.2

this.connection?.loggelf({
short_message: '[TOOBIG] Too big literal used',
_error: 'toobig',
_service: 'imap',
_command: this.command,
_payload: this.payload ? (this.payload.length < 256 ? this.payload : this.payload.toString().substring(0, 256) + '...') : command.value,
_literal_expecting: command.expecting,
_literal_allowed: maxAllowed,
_sess: this.connection?.session?.id,
_user: this.connection?.user?.id,
_cid: this.connection?.id,
_ip: this.remoteAddress
});

this.connection.send(this.tag + ' NO [TOOBIG] Literal too large');
} else {
this.connection.send(this.tag + ' NO Literal too large');
Expand Down
8 changes: 7 additions & 1 deletion imap-core/lib/imap-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,13 @@ class IMAPConnection extends EventEmitter {
}

if (!command.final) {
currentCommand.append(command, callback);
currentCommand.append(command, (err, ...args) => {
if (err) {
// cancel pending command
this._currentCommand = false;
}
callback(err, ...args);
});
} else {
this._currentCommand = false;
currentCommand.end(command, callback);
Expand Down

2 comments on commit f2c8545

@titanism
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the IDLE bug here that was fixed @andris9?

@andris9
Copy link
Member Author

Choose a reason for hiding this comment

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

If you had the following issue with Outlook as the mail client:

C: IDLE
S: BAD Not enough arguments provided

Please sign in to comment.