aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-09-25 20:17:12 +0200
committerBond_009 <bond.009@outlook.com>2021-09-25 20:17:12 +0200
commita4eede29abf1cf380c959835e59b7062ead1a654 (patch)
tree540d9a0428939b88ad046f7684612c6e9e5d96fc /Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs
parent2ee3e9e00f62ff8b0139f1273d7666d0f6c549a4 (diff)
Use RandomAccess instead of a FileStream where it makes sense
Diffstat (limited to 'Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs')
-rw-r--r--Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs b/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs
index 4abd5b36d..2296ac5c8 100644
--- a/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs
+++ b/Jellyfin.Server/Infrastructure/SymlinkFollowingPhysicalFileResultExecutor.cs
@@ -55,8 +55,8 @@ namespace Jellyfin.Server.Infrastructure
// This may or may not be fixed in .NET 6, but looks like it will not https://github.com/dotnet/aspnetcore/issues/34371
if ((fileInfo.Attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint)
{
- using Stream thisFileStream = File.OpenRead(path);
- length = thisFileStream.Length;
+ using var fileHandle = File.OpenHandle(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ length = RandomAccess.GetLength(fileHandle);
}
return new FileMetadata