diff options
| author | Cody Robibero <cody@robibe.ro> | 2022-02-06 15:25:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-06 15:25:48 -0700 |
| commit | b6489e73abd82738d7cb7aa2a5921db865dcd9d9 (patch) | |
| tree | bb7ecba76748a1725f7fd2234ae88a2a634b7bde /Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs | |
| parent | 10d52d16a8c4af67e0aa05e9a5f8b63fdf264e53 (diff) | |
| parent | e7be01d7a5b7d2e93d8ee0fddb812c2ce048db50 (diff) | |
Merge pull request #7241 from Bond-009/async5
Diffstat (limited to 'Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs')
| -rw-r--r-- | Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs b/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs index 73a619b8d..7e7e4ca95 100644 --- a/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs +++ b/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs @@ -125,18 +125,20 @@ namespace Jellyfin.Server.Infrastructure // Copied from SendFileFallback.SendFileAsync const int BufferSize = 1024 * 16; - await using var fileStream = new FileStream( + var fileStream = new FileStream( filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize: BufferSize, options: FileOptions.Asynchronous | FileOptions.SequentialScan); - - fileStream.Seek(offset, SeekOrigin.Begin); - await StreamCopyOperation - .CopyToAsync(fileStream, response.Body, count, BufferSize, CancellationToken.None) - .ConfigureAwait(true); + await using (fileStream.ConfigureAwait(false)) + { + fileStream.Seek(offset, SeekOrigin.Begin); + await StreamCopyOperation + .CopyToAsync(fileStream, response.Body, count, BufferSize, CancellationToken.None) + .ConfigureAwait(true); + } } private static bool IsSymLink(string path) => (File.GetAttributes(path) & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint; |
