From 36312c92f56671484caaeaf89e28f7737723e97d Mon Sep 17 00:00:00 2001 From: Ken Brazier Date: Sun, 31 May 2020 16:40:02 -0600 Subject: [PATCH 1/3] 2354 open soft-links to read size --- Emby.Server.Implementations/IO/ManagedFileSystem.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 7461ec4f1d..8b75e8c708 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -245,6 +245,16 @@ namespace Emby.Server.Implementations.IO if (info is FileInfo fileInfo) { result.Length = fileInfo.Length; + + // Issue #2354 get the size of files behind symbolic links + if(fileInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)) + { + using (Stream thisFileStream = File.OpenRead(fileInfo.ToString())) + { + result.Length = thisFileStream.Length; + } + } + result.DirectoryName = fileInfo.DirectoryName; } From d719ca78b40695b02b03c912b636652545eff3e8 Mon Sep 17 00:00:00 2001 From: Ken Date: Sat, 18 Jul 2020 19:39:31 -0600 Subject: [PATCH 2/3] Spacing standard on Emby.Server.Implementations/IO/ManagedFileSystem.cs Co-authored-by: Cody Robibero --- Emby.Server.Implementations/IO/ManagedFileSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 530c16195a..08e0cf447e 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -247,7 +247,7 @@ namespace Emby.Server.Implementations.IO result.Length = fileInfo.Length; // Issue #2354 get the size of files behind symbolic links - if(fileInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)) + if (fileInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)) { using (Stream thisFileStream = File.OpenRead(fileInfo.ToString())) { From eea142cad1d3bfe49f3fb804902b3346174c31ea Mon Sep 17 00:00:00 2001 From: Ken Date: Sat, 18 Jul 2020 19:40:28 -0600 Subject: [PATCH 3/3] FullName property instead of ToString in Emby.Server.Implementations/IO/ManagedFileSystem.cs Co-authored-by: Cody Robibero --- Emby.Server.Implementations/IO/ManagedFileSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 08e0cf447e..ab6483bf9f 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -249,7 +249,7 @@ namespace Emby.Server.Implementations.IO // Issue #2354 get the size of files behind symbolic links if (fileInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)) { - using (Stream thisFileStream = File.OpenRead(fileInfo.ToString())) + using (Stream thisFileStream = File.OpenRead(fileInfo.FullName)) { result.Length = thisFileStream.Length; }