From 5854b2e63f2d68727156e45c6ad5b3194d92f404 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Sun, 20 Mar 2022 09:46:15 -0700 Subject: [PATCH] Maybe fix interval logs on Windows (#108) Seems the checked-in test file has `\r\n` line endings on Windows, and since we consider the encoded histogram as being everything up until the `\n`, this makes the `\r` part of the encoded, which then makes it invalid base64! --- src/serialization/interval_log/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/serialization/interval_log/mod.rs b/src/serialization/interval_log/mod.rs index f25ec96..3f39e50 100644 --- a/src/serialization/interval_log/mod.rs +++ b/src/serialization/interval_log/mod.rs @@ -743,6 +743,8 @@ fn interval_hist(input: &[u8]) -> IResult<&[u8], LogEntry> { let (input, max) = double(input)?; let (input, _) = char(',')(input)?; let (input, encoded_histogram) = map_res(take_until("\n"), str::from_utf8)(input)?; + // Be nice to Windows users: + let encoded_histogram = encoded_histogram.trim_end_matches('\r'); let (input, _) = take(1_usize)(input)?; Ok((