Skip to content

Commit

Permalink
Don't create a copy of the in memory stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Jan 5, 2024
1 parent f172def commit 1d7266e
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 @@ -71,7 +71,7 @@ public async Task<Stream> GetFileStreamAsync(string path, StreamMode streamMode,

// Copied from SaveFileAsync
_logger.LogTrace("Saving {Path}", normalizedPath);
byte[] 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 1d7266e

Please sign in to comment.