1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

Fixed: Extra new line in release restrictions causing all releases to be rejected

This commit is contained in:
Mark McDowall 2014-01-15 12:39:32 -08:00
parent 2dd7fb9fdf
commit 885872ff3a
3 changed files with 17 additions and 8 deletions

View File

@ -16,12 +16,12 @@ public class NotRestrictedReleaseSpecificationFixture : CoreTest<NotRestrictedRe
public void Setup()
{
_parseResult = new RemoteEpisode
{
Release = new ReleaseInfo
{
Title = "Dexter.S08E01.EDITED.WEBRip.x264-KYR"
}
};
{
Release = new ReleaseInfo
{
Title = "Dexter.S08E01.EDITED.WEBRip.x264-KYR"
}
};
}
[Test]
@ -49,5 +49,12 @@ public void should_be_true_when_nzb_does_not_contain_a_restricted_term(string re
Mocker.GetMock<IConfigService>().SetupGet(c => c.ReleaseRestrictions).Returns(restrictions);
Subject.IsSatisfiedBy(_parseResult, null).Should().BeTrue();
}
[Test]
public void should_not_try_to_find_empty_string_as_a_match()
{
Mocker.GetMock<IConfigService>().SetupGet(c => c.ReleaseRestrictions).Returns("test\n");
Subject.IsSatisfiedBy(_parseResult, null).Should().BeTrue();
}
}
}

View File

@ -231,8 +231,8 @@ public PriorityType NzbgetOlderTvPriority
public string ReleaseRestrictions
{
get { return GetValue("ReleaseRestrictions", String.Empty); }
set { SetValue("ReleaseRestrictions", value); }
get { return GetValue("ReleaseRestrictions", String.Empty).Trim('\r', '\n'); }
set { SetValue("ReleaseRestrictions", value.Trim('\r', '\n')); }
}
public Int32 RssSyncInterval

View File

@ -41,6 +41,8 @@ public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase sear
foreach (var restriction in restrictions)
{
if (String.IsNullOrWhiteSpace(restriction)) continue;
if (subject.Release.Title.ToLowerInvariant().Contains(restriction.ToLowerInvariant()))
{
_logger.Trace("{0} is restricted: {1}", subject, restriction);