Allow `GetFileSize` to follow symlinks

pull/7387/head v4.0.10.2656
Elias Benbourenane 3 months ago committed by GitHub
parent 3e99917e9d
commit ca0bb14027
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -189,6 +189,18 @@ namespace NzbDrone.Common.Disk
}
var fi = new FileInfo(path);
// If the file is a symlink, resolve the target path and get the size of the target file.
if (fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
{
var targetPath = fi.ResolveLinkTarget(true)?.FullName;
if (targetPath != null)
{
fi = new FileInfo(targetPath);
}
}
return fi.Length;
}

Loading…
Cancel
Save