Skip to content

Commit

Permalink
Merge pull request #71 from Arlodotexe/fix/httpfile/large-files
Browse files Browse the repository at this point in the history
Fixed reading files larger than 2GB with HttpFile
  • Loading branch information
Arlodotexe authored Sep 7, 2024
2 parents d68f9b4 + a12f4bb commit 49609e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 191 deletions.
188 changes: 0 additions & 188 deletions src/Internal/LazySeekStream.cs

This file was deleted.

7 changes: 7 additions & 0 deletions src/OwlCore.Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
<PackageReleaseNotes>
--- 0.12.0 ---
[Breaking]
The Stream opened from HttpFile is no longer seekable, as the internal LazySeekStream and all usages have been removed.

[Fixes]
Fixes an issue where files larger than 2GB couldn't be fully read via HttpFile.

--- 0.11.3 ---
[Improvement]
Removed redundant validation when enumerating files and folders to improve performance in SystemFile and SystemFolder.
Expand Down
5 changes: 2 additions & 3 deletions src/System/Net/Http/HttpFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ public async Task<Stream> OpenStreamAsync(FileAccess accessMode = FileAccess.Rea
// Extract the content length if available
long? length = response.Content.Headers.ContentLength;

if (length is long notNullLength)
if (length is { } notNullLength)
contentStream = new LengthOverrideStream(contentStream, notNullLength);

// Return in a lazy seek-able wrapper.
return new LazySeekStream(contentStream);
return contentStream;
}
}

0 comments on commit 49609e0

Please sign in to comment.