From 45868fbaf06547d5e6c57b7e948a688429414b50 Mon Sep 17 00:00:00 2001 From: Teddy Tennant Date: Sat, 8 Aug 2026 17:11:06 -0400 Subject: [PATCH] fix(patch): accept CRLF line endings in the ---/+++ headers A carriage return before the newline terminating a `--- `/`+++ ` line was treated as part of the filename. Since a carriage return has to be quoted in a filename, every patch generated on Windows failed to parse with `InvalidCharInUnquotedFilename`. Strip a single trailing carriage return from the filename field. A raw carriage return can never occur inside a filename: unquoted filenames reject it, and quoted ones write it as the `\r` escape. A carriage return anywhere else on the line is still rejected as before. Signed-off-by: Teddy Tennant --- src/patch/parse.rs | 6 ++- src/patch/tests.rs | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/src/patch/parse.rs b/src/patch/parse.rs index 793ae31..624d756 100644 --- a/src/patch/parse.rs +++ b/src/patch/parse.rs @@ -181,7 +181,11 @@ fn parse_filename<'a, T: Text + ?Sized>(prefix: &str, line: &'a T) -> Result