mirror of
https://github.com/Readarr/Readarr
synced 2026-01-13 02:53:19 +01:00
Fixed: Migrating case-sensitive Preferred Word REGEX to Custom Formats
Closes #2162
This commit is contained in:
parent
6f7c6721db
commit
71c2b1aeec
2 changed files with 66 additions and 1 deletions
|
|
@ -360,6 +360,68 @@ public void should_set_zero_scores_for_disabled_release_profiles()
|
|||
customFormats.First().FormatItems.First().Score.Should().Be(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_migrate_case_sensitive_regex()
|
||||
{
|
||||
var db = WithMigrationTestDb(c =>
|
||||
{
|
||||
c.Insert.IntoTable("ReleaseProfiles").Row(new
|
||||
{
|
||||
Preferred = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
Key = "/somestring/",
|
||||
Value = 2
|
||||
}
|
||||
}.ToJson(),
|
||||
Required = "[]",
|
||||
Ignored = "[]",
|
||||
Tags = "[]",
|
||||
IncludePreferredWhenRenaming = true,
|
||||
Enabled = true,
|
||||
IndexerId = 0
|
||||
});
|
||||
});
|
||||
|
||||
var customFormats = db.Query<CustomFormat026>("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
|
||||
{
|
||||
Preferred = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
Key = "/somestring/i",
|
||||
Value = 2
|
||||
}
|
||||
}.ToJson(),
|
||||
Required = "[]",
|
||||
Ignored = "[]",
|
||||
Tags = "[]",
|
||||
IncludePreferredWhenRenaming = true,
|
||||
Enabled = true,
|
||||
IndexerId = 0
|
||||
});
|
||||
});
|
||||
|
||||
var customFormats = db.Query<CustomFormat026>("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_naming_configs()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -148,7 +148,10 @@ private void MigratePreferredTerms(IDbConnection conn, IDbTransaction tran)
|
|||
|
||||
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 a new issue