[PATCH] nntp: use trim_end_matches() to remove only \r and \n
Tetsuo Handa <[email protected]> Mon, 20 Jul 2026 13:19:49 +0900
| Newsgroups | dev.linux.lists.sashiko |
|---|---|
| Message-ID | <[email protected]> |
Since trim_end() eliminates all trailing white space characters, a patch gets corrupted when there is a line with trailing white space characters. Closes: #320 Signed-off-by: Tetsuo Handa <[email protected]> --- src/nntp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nntp.rs b/src/nntp.rs index a3315cd..9c3b20f 100644 --- a/src/nntp.rs +++ b/src/nntp.rs @@ -107,7 +107,7 @@ impl NntpClient { } let line_raw = String::from_utf8_lossy(&buf); - let line = line_raw.trim_end(); // remove \r\n + let line = line_raw.trim_end_matches(['\r', '\n']); if line == "." { break; @@ -164,7 +164,7 @@ impl NntpClient { // Convert to string (lossy) let line_raw = String::from_utf8_lossy(&buf); - let line = line_raw.trim_end(); // remove \r\n + let line = line_raw.trim_end_matches(['\r', '\n']); if line == "." { break; -- 2.55.0