mirror of
https://github.com/Sonarr/Sonarr
synced 2025-02-23 22:51:19 +00:00
Fixed: Ignore free space check before grabbing if directory is missing
Closes #7273
This commit is contained in:
parent
c8f419b014
commit
354ed96572
2 changed files with 25 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using System.IO;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -90,5 +91,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_return_true_if_root_folder_is_not_available()
|
||||||
|
{
|
||||||
|
WithMinimumFreeSpace(150);
|
||||||
|
WithSize(100);
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>().Setup(s => s.GetAvailableSpace(It.IsAny<string>())).Throws<DirectoryNotFoundException>();
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeTrue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.IO;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
@ -32,11 +33,21 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
}
|
}
|
||||||
|
|
||||||
var size = subject.Release.Size;
|
var size = subject.Release.Size;
|
||||||
var freeSpace = _diskProvider.GetAvailableSpace(subject.Series.Path);
|
var path = subject.Series.Path;
|
||||||
|
long? freeSpace = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
freeSpace = _diskProvider.GetAvailableSpace(path);
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException)
|
||||||
|
{
|
||||||
|
// Ignore so it'll be skipped in the following checks
|
||||||
|
}
|
||||||
|
|
||||||
if (!freeSpace.HasValue)
|
if (!freeSpace.HasValue)
|
||||||
{
|
{
|
||||||
_logger.Debug("Unable to get available space for {0}. Skipping", subject.Series.Path);
|
_logger.Debug("Unable to get available space for {0}. Skipping", path);
|
||||||
|
|
||||||
return Decision.Accept();
|
return Decision.Accept();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue