From 468c2b78b079e120a3c94714a17eec472cc7ed2a Mon Sep 17 00:00:00 2001 From: Georg Veichtlbauer Date: Tue, 17 Dec 2024 13:48:34 +0100 Subject: [PATCH] fix: trim lines read after decoding Some POP servers send replies like: (LF)+OK(CRLF) ... Which causes a format exception when parsing the reply. Fix this by trimming lines. --- lib/src/private/util/uint8_list_reader.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/private/util/uint8_list_reader.dart b/lib/src/private/util/uint8_list_reader.dart index 92c8544e..2b372b0d 100644 --- a/lib/src/private/util/uint8_list_reader.dart +++ b/lib/src/private/util/uint8_list_reader.dart @@ -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; } @@ -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(); }