1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-22 16:02:43 +00:00

Fixed: Don't fail import if symlink target can't be resolved

(cherry picked from commit 8cb58a63d8ec1b290bc57ad2cf1e90809ceebce9)
This commit is contained in:
Mark McDowall 2024-12-01 08:59:44 -08:00 committed by Bogdan
parent 5bac157d36
commit 3449a5d3fe

View file

@ -190,6 +190,8 @@ public long GetFileSize(string path)
var fi = new FileInfo(path); var fi = new FileInfo(path);
try
{
// If the file is a symlink, resolve the target path and get the size of the target file. // If the file is a symlink, resolve the target path and get the size of the target file.
if (fi.Attributes.HasFlag(FileAttributes.ReparsePoint)) if (fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
{ {
@ -200,6 +202,11 @@ public long GetFileSize(string path)
fi = new FileInfo(targetPath); fi = new FileInfo(targetPath);
} }
} }
}
catch (IOException ex)
{
Logger.Trace(ex, "Unable to resolve symlink target for {0}", path);
}
return fi.Length; return fi.Length;
} }