Fixed: A as part of an acronym being removed from clean title. Fixes #1747

Leonardo Galli 7 years ago
parent 7712aa62da
commit 1f4c2ad946

@ -72,6 +72,40 @@ namespace NzbDrone.Core.Test.ParserTests
}
}
[Test]
public void should_not_remove_a_when_at_start_of_acronym()
{
var dirtyFormat = new[]
{
"word.{0}.N.K.L.E.word",
"word {0} N K L E word",
"word-{0}-N-K-L-E-word",
};
foreach (var s in dirtyFormat)
{
var dirty = string.Format(s, "a");
dirty.CleanSeriesTitle().Should().Be("wordankleword");
}
}
[Test]
public void should_not_remove_a_when_at_end_of_acronym()
{
var dirtyFormat = new[]
{
"word.N.K.L.E.{0}.word",
"word N K L E {0} word",
"word-N-K-L-E-{0}-word",
};
foreach (var s in dirtyFormat)
{
var dirty = string.Format(s, "a");
dirty.CleanSeriesTitle().Should().Be("wordnkleaword");
}
}
[TestCase("the")]
[TestCase("and")]
[TestCase("or")]

@ -278,7 +278,7 @@ namespace NzbDrone.Core.Parser
//Regex to detect whether the title was reversed.
private static readonly Regex ReversedTitleRegex = new Regex(@"[-._ ](p027|p0801|\d{2}E\d{2}S)[-._ ]", RegexOptions.Compiled);
private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?<!^)(a(?!$)|an|the|and|or|of)(?:\b|_))|\W|_",
private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?<!^|\W\w\W)(a(?!$|\W\w\W)|an|the|and|or|of)(?:\b|_))|\W|_",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",

Loading…
Cancel
Save