mirror of https://github.com/Sonarr/Sonarr
Fixed: Migrating case-sensitive Preferred Word REGEX to Custom Formats
Closes #5399
This commit is contained in:
parent
0f111dd066
commit
119addd75f
|
@ -482,6 +482,70 @@ namespace NzbDrone.Core.Test.Datastore.Migration
|
|||
customFormats.First().AnimeEpisodeFormat.Should().Be("{Series Title} - S{season:00}E{episode:00} - {Custom_Formats} {Quality Full}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_migrate_case_sensitive_regex()
|
||||
{
|
||||
var db = WithMigrationTestDb(c =>
|
||||
{
|
||||
c.Insert.IntoTable("ReleaseProfiles").Row(new
|
||||
{
|
||||
Name = "Profile",
|
||||
Preferred = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
Key = "/somestring/",
|
||||
Value = 2
|
||||
}
|
||||
}.ToJson(),
|
||||
Required = "[]",
|
||||
Ignored = "[]",
|
||||
Tags = "[]",
|
||||
IncludePreferredWhenRenaming = true,
|
||||
Enabled = true,
|
||||
IndexerId = 0
|
||||
});
|
||||
});
|
||||
|
||||
var customFormats = db.Query<CustomFormat171>("SELECT Id, Name, IncludeCustomFormatWhenRenaming, Specifications FROM CustomFormats");
|
||||
|
||||
customFormats.Should().HaveCount(1);
|
||||
customFormats.First().Specifications.Should().HaveCount(1);
|
||||
customFormats.First().Specifications.First().Body.Value.Should().Be("somestring");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_migrate_case_insensitive_regex()
|
||||
{
|
||||
var db = WithMigrationTestDb(c =>
|
||||
{
|
||||
c.Insert.IntoTable("ReleaseProfiles").Row(new
|
||||
{
|
||||
Name = "Profile",
|
||||
Preferred = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
Key = "/somestring/i",
|
||||
Value = 2
|
||||
}
|
||||
}.ToJson(),
|
||||
Required = "[]",
|
||||
Ignored = "[]",
|
||||
Tags = "[]",
|
||||
IncludePreferredWhenRenaming = true,
|
||||
Enabled = true,
|
||||
IndexerId = 0
|
||||
});
|
||||
});
|
||||
|
||||
var customFormats = db.Query<CustomFormat171>("SELECT Id, Name, IncludeCustomFormatWhenRenaming, Specifications FROM CustomFormats");
|
||||
|
||||
customFormats.Should().HaveCount(1);
|
||||
customFormats.First().Specifications.Should().HaveCount(1);
|
||||
customFormats.First().Specifications.First().Body.Value.Should().Be("somestring");
|
||||
}
|
||||
|
||||
private class NamingConfig171
|
||||
{
|
||||
public string StandardEpisodeFormat { get; set; }
|
||||
|
|
|
@ -101,7 +101,10 @@ namespace NzbDrone.Core.Datastore.Migration
|
|||
|
||||
foreach (var term in data)
|
||||
{
|
||||
var regexTerm = term.Key.TrimStart('/').TrimEnd("/i");
|
||||
var regexTerm = term.Key
|
||||
.TrimStart('/')
|
||||
.TrimEnd('/')
|
||||
.TrimEnd("/i");
|
||||
|
||||
// Validate Regex before creating a CF
|
||||
try
|
||||
|
|
Loading…
Reference in New Issue