From 08acaf9290469915eddbcf403c653492fe77aa4f Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 14 Mar 2024 21:26:45 +1100 Subject: [PATCH] Update IoHelpers.cs --- src/Verify/IoHelpers.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Verify/IoHelpers.cs b/src/Verify/IoHelpers.cs index 277697f3cb..4db6df4eab 100644 --- a/src/Verify/IoHelpers.cs +++ b/src/Verify/IoHelpers.cs @@ -117,8 +117,12 @@ public static async Task ReadStringBuilderWithFixedLines(this Str { stream.MoveToStart(); using var reader = new StreamReader(stream); - var builder = new StringBuilder(await reader.ReadToEndAsync()); - builder.FixNewlines(); + var contents = await reader.ReadToEndAsync(); + var builder = new StringBuilder(contents); + if (contents.Contains('\n')) + { + builder.FixNewlines(); + } return builder; }