Skip to content

Commit

Permalink
Changed TOOBIG error message
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Oct 10, 2024
1 parent f2c8545 commit 1b700fd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions imap-core/lib/imap-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,15 @@ class IMAPCommand {
// APPENDLIMIT response for too large messages
// TOOBIG: https://tools.ietf.org/html/rfc4469#section-4.2

let errorMessage;
if (this.command === 'APPEND') {
errorMessage = `Message size exceeds allowed limit: attempted ${command.expecting} bytes, but maximum allowed is ${maxAllowed} bytes.`;
} else {
errorMessage = 'Literal too large';
}

this.connection?.loggelf({
short_message: '[TOOBIG] Too big literal used',
short_message: `[TOOBIG] ${errorMessage}`,
_error: 'toobig',
_service: 'imap',
_command: this.command,
Expand All @@ -162,9 +169,9 @@ class IMAPCommand {
_ip: this.remoteAddress
});

this.connection.send(this.tag + ' NO [TOOBIG] Literal too large');
this.connection.send(`${this.tag} NO [TOOBIG] ${errorMessage}`);
} else {
this.connection.send(this.tag + ' NO Literal too large');
this.connection.send(`${this.tag} NO Literal too large`);
}

let err = new Error('Literal too large');
Expand Down

0 comments on commit 1b700fd

Please sign in to comment.