Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes doesn't parsing emails #32

Merged
merged 3 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions __mocks__/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ CjxIVE1MPjxCT0RZPjxkaXY+MTIzPC9kaXY+PGRpdj4xMjM8L2Rpdj48ZGl2IGRhdGEtc2lnbmF0
dXJlLXdpZGdldD0iY29udGFpbmVyIj48ZGl2IGRhdGEtc2lnbmF0dXJlLXdpZGdldD0iY29udGVu
dCI+PGRpdj4tLTxicj5ZYXBvcGxlIFlhcG9wbGU8L2Rpdj48L2Rpdj48L2Rpdj48L0JPRFk+PC9I
VE1MPgo=
----ALT--e2F8f5F19Ae0d3Ad5402B90c94Da42261610599299--
.` + '\r\n';
----ALT--e2F8f5F19Ae0d3Ad5402B90c94Da42261610599299--`+ '\r\n.\r\n';

let messages = Array.from(new Array(4)).fill(msg);

Expand Down
1 change: 1 addition & 0 deletions lib/yapople.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ 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' ||
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe move the condition to the next line? Smth like this:

if (
  this.flow.slice(this.flow.length - 5).toString() === '\r\n.\r\n' || 
  sData.substr(-5) === '\r\n.\r\n'
)

Because, at line 165-166 I remove five symbols, not three at the end (I don't remember why I did this 😄)
And I think that \r\n.\r\n in the specification also should work for TOP and LIST commands

sData.substr(-3) === '.\r\n'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yapople",
"version": "0.4.8",
"version": "0.4.9",
"author": "Andrew D.Laptev <a.d.laptev@gmail.com>",
"description": "Yet another POP3 library",
"main": "lib/yapople.js",
Expand Down