Skip to content

Commit

Permalink
Cleaning repetitive logic
Browse files Browse the repository at this point in the history
  • Loading branch information
devchanki committed May 16, 2024
1 parent 5ed2d73 commit f174933
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/yapople.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ function onData(data) {
if (typeof this.flow !== 'undefined') { // for first and all next data chunks
this.flow = Buffer.concat([this.flow, data]); // append chunk to buffer

if (this._command.cmd === state.RETR && this.flow.slice(-5).toString() !== '\r\n.\r\n') return;
if (
this.flow.slice(this.flow.length - 3).toString() === '.\r\n' ||
sData.substr(-3) === '.\r\n'
this.flow.slice(this.flow.length - 5).toString() === '\r\n.\r\n' || sData.substr(-5) === '\r\n.\r\n'
) {
this.flow = this.flow.slice(0, this.flow.length - 5);
if (this.mailparser) {
Expand Down

0 comments on commit f174933

Please sign in to comment.