mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-01-29 20:14:00 +00:00
Fixed: Migrating case-sensitive Preferred Word REGEX to Custom Formats
Closes #2162
This commit is contained in:
@@ -360,6 +360,68 @@ namespace NzbDrone.Core.Test.Datastore.Migration
|
||||
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 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user