mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
Merge pull request #5746 from cvium/dangling-symlinks
This commit is contained in:
commit
62117a6c12
1 changed files with 11 additions and 2 deletions
|
@ -249,9 +249,18 @@ namespace Emby.Server.Implementations.IO
|
||||||
// Issue #2354 get the size of files behind symbolic links
|
// 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.FullName))
|
try
|
||||||
{
|
{
|
||||||
result.Length = thisFileStream.Length;
|
using (Stream thisFileStream = File.OpenRead(fileInfo.FullName))
|
||||||
|
{
|
||||||
|
result.Length = thisFileStream.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException ex)
|
||||||
|
{
|
||||||
|
// Dangling symlinks cannot be detected before opening the file unfortunately...
|
||||||
|
Logger.LogError(ex, "Reading the file size of the symlink at {Path} failed. Marking the file as not existing.", fileInfo.FullName);
|
||||||
|
result.Exists = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue