From 016223f6da70b6f7e1b1452562377e944f4e157d Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Fri, 5 Jan 2024 15:08:24 -0600 Subject: [PATCH] Don't copy array twice --- src/Foundatio/Storage/InMemoryFileStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Foundatio/Storage/InMemoryFileStorage.cs b/src/Foundatio/Storage/InMemoryFileStorage.cs index 26290b71..ab1a3aa3 100644 --- a/src/Foundatio/Storage/InMemoryFileStorage.cs +++ b/src/Foundatio/Storage/InMemoryFileStorage.cs @@ -65,7 +65,7 @@ public Task GetFileStreamAsync(string path, StreamMode streamMode, Cance var actionableStream = new ActionableStream(stream, () => { stream.Position = 0; - var contents = ReadBytes(stream); + byte[] contents = stream.ToArray(); if (contents.Length > MaxFileSize) throw new ArgumentException($"File size {contents.Length.ToFileSizeDisplay()} exceeds the maximum size of {MaxFileSize.ToFileSizeDisplay()}.");