Skip to content

Commit

Permalink
fix: trim lines read after decoding
Browse files Browse the repository at this point in the history
Some POP servers send replies like:
(LF)+OK(CRLF)
...

Which causes a format exception when parsing the reply.
Fix this by trimming lines.
  • Loading branch information
vware committed Dec 17, 2024
1 parent 0df187c commit 468c2b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/private/util/uint8_list_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Uint8ListReader {
return null;
}
final data = _builder.takeFirst(pos + 1);
final line = _utf8decoder.convert(data, 0, pos - 1);
final line = _utf8decoder.convert(data, 0, pos - 1).trimLeft();

return line;
}
Expand All @@ -42,7 +42,7 @@ class Uint8ListReader {
return null;
}
final data = _builder.takeFirst(pos + 1);
final text = _utf8decoder.convert(data);
final text = _utf8decoder.convert(data).trimLeft();

return text.split('\r\n')..removeLast();
}
Expand Down

0 comments on commit 468c2b7

Please sign in to comment.