@bobfrankston/rmfmail 1.2.14 → 1.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8551,6 +8551,15 @@ var NativeImapClient = class {
8551
8551
  const literalBytes = this.buffer.subarray(this.bufferOffset, this.bufferOffset + neededBytes);
8552
8552
  this.bufferOffset += neededBytes;
8553
8553
  let literal = this.utf8Decoder.decode(literalBytes);
8554
+ if (this.pendingCommand.currentLiteralKey?.startsWith("BODY") && /^[A-Za-z]+\d+\s+(SELECT|FETCH|UID|LOGIN|STATUS|EXAMINE|LIST|IDLE|NOOP|STORE|SEARCH|CAPABILITY|CLOSE|LOGOUT|APPEND|COPY|MOVE|EXPUNGE|CREATE|DELETE|RENAME|SUBSCRIBE|ENABLE|STARTTLS)\b/i.test(literal.slice(0, 80).replace(/^[\s*]+/, ""))) {
8555
+ const litStart = this.bufferOffset - neededBytes;
8556
+ const ctxStart = Math.max(0, litStart - 256);
8557
+ const ctx = this.buffer.subarray(ctxStart, litStart);
8558
+ const ascii = Array.from(ctx).map((b) => b >= 32 && b < 127 ? String.fromCharCode(b) : b === 13 ? "\\r" : b === 10 ? "\\n" : ".").join("");
8559
+ console.error(` [imap] DESYNC CAPTURE key=${this.pendingCommand.currentLiteralKey} declaredLiteral=${neededBytes}B bufferOffset=${this.bufferOffset} bufferLength=${this.bufferLength} litStart=${litStart}`);
8560
+ console.error(` [imap] DESYNC literal[0..200]=${JSON.stringify(literal.slice(0, 200))}`);
8561
+ console.error(` [imap] DESYNC preceding[${ctx.length}B]=${JSON.stringify(ascii)}`);
8562
+ }
8554
8563
  if (!this.pendingCommand.currentLiteralKey) {
8555
8564
  literal = `"${literal.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\r?\n/g, "")}"`;
8556
8565
  }