mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 15:32:31 +01:00
Fixed: Prevent getting disk space from returning no information when it partially fails
Closes #5247
This commit is contained in:
parent
9c1fd7c73e
commit
2c65e4fa41
@ -168,13 +168,31 @@ namespace NzbDrone.Mono.Disk
|
||||
|
||||
protected override List<IMount> GetAllMounts()
|
||||
{
|
||||
return _procMountProvider.GetMounts()
|
||||
.Concat(GetDriveInfoMounts()
|
||||
var mounts = new List<IMount>();
|
||||
|
||||
try
|
||||
{
|
||||
mounts.AddRange(_procMountProvider.GetMounts());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Warn(e, $"Unable to get mounts: {e.Message}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
mounts.AddRange(GetDriveInfoMounts()
|
||||
.Select(d => new DriveInfoMount(d, FindDriveType.Find(d.DriveFormat)))
|
||||
.Where(d => d.DriveType == DriveType.Fixed ||
|
||||
d.DriveType == DriveType.Network ||
|
||||
d.DriveType == DriveType.Removable))
|
||||
.DistinctBy(v => v.RootDirectory)
|
||||
d.DriveType == DriveType.Removable));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Warn(e, $"Unable to get drive mounts: {e.Message}");
|
||||
}
|
||||
|
||||
return mounts.DistinctBy(v => v.RootDirectory)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user