Skip to content

Commit

Permalink
Don't copy array twice
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Jan 5, 2024
1 parent 2b307d7 commit 016223f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Foundatio/Storage/InMemoryFileStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Task<Stream> 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()}.");

Expand Down

0 comments on commit 016223f

Please sign in to comment.