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