mirror of https://github.com/Sonarr/Sonarr
Never allow empty episode formats to be saved
This commit is contained in:
parent
c90d010cd8
commit
767586304a
|
@ -37,12 +37,8 @@ namespace NzbDrone.Api.Config
|
||||||
Get["/samples"] = x => GetExamples(this.Bind<NamingConfigResource>());
|
Get["/samples"] = x => GetExamples(this.Bind<NamingConfigResource>());
|
||||||
|
|
||||||
SharedValidator.RuleFor(c => c.MultiEpisodeStyle).InclusiveBetween(0, 3);
|
SharedValidator.RuleFor(c => c.MultiEpisodeStyle).InclusiveBetween(0, 3);
|
||||||
|
SharedValidator.RuleFor(c => c.StandardEpisodeFormat).ValidEpisodeFormat();
|
||||||
SharedValidator.When(spec => spec.RenameEpisodes, () =>
|
SharedValidator.RuleFor(c => c.DailyEpisodeFormat).ValidDailyEpisodeFormat();
|
||||||
{
|
|
||||||
SharedValidator.RuleFor(c => c.StandardEpisodeFormat).ValidEpisodeFormat();
|
|
||||||
SharedValidator.RuleFor(c => c.DailyEpisodeFormat).ValidDailyEpisodeFormat();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateNamingConfig(NamingConfigResource resource)
|
private void UpdateNamingConfig(NamingConfigResource resource)
|
||||||
|
|
|
@ -81,10 +81,8 @@ namespace NzbDrone.Integration.Test
|
||||||
config.StandardEpisodeFormat = "";
|
config.StandardEpisodeFormat = "";
|
||||||
config.DailyEpisodeFormat = "";
|
config.DailyEpisodeFormat = "";
|
||||||
|
|
||||||
var result = NamingConfig.Put(config);
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
result.RenameEpisodes.Should().BeFalse();
|
errors.Should().NotBeEmpty();
|
||||||
result.StandardEpisodeFormat.Should().Be(config.StandardEpisodeFormat);
|
|
||||||
result.DailyEpisodeFormat.Should().Be(config.DailyEpisodeFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in New Issue