Browse Source

Merge pull request #3585 from Ken-g6/2354-soft-link-sizes

2354 fix soft link sizes
Bond-009 4 years ago
parent
commit
ce07e45897
1 changed files with 10 additions and 0 deletions
  1. 10 0
      Emby.Server.Implementations/IO/ManagedFileSystem.cs

+ 10 - 0
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.FullName))
+                        {
+                            result.Length = thisFileStream.Length;
+                        }
+                    }
+
                     result.DirectoryName = fileInfo.DirectoryName;
                 }