Fixed: Error splitting subtitle from book title

Fixes #1473
Fixes READARR-39N
Fixes READARR-3ES
Fixes READARR-6CM
pull/1504/head
ta264 2 years ago
parent 967dae5132
commit ecf1e1a130

@ -280,6 +280,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Andrew Steele", "Ageless: The New Science of Getting Older Without Getting Old", "Ageless", "The New Science of Getting Older Without Getting Old")]
[TestCase("Author", "Title (Subtitle with spaces)", "Title", "Subtitle with spaces")]
[TestCase("Author", "Title (Unabridged)", "Title (Unabridged)", "")]
[TestCase("Author", "asdf)(", "asdf)(", "")]
public void should_split_title_correctly(string author, string book, string expectedTitle, string expectedSubtitle)
{
var (title, subtitle) = book.SplitBookTitle(author);

@ -413,7 +413,7 @@ namespace NzbDrone.Core.Parser
return null;
}
private static string GetTitleFuzzy(string report, string name, out string remainder)
public static string GetTitleFuzzy(string report, string name, out string remainder)
{
remainder = report;
@ -600,8 +600,8 @@ namespace NzbDrone.Core.Parser
if (parenthesis > -1)
{
var endParenthesis = book.IndexOf(')');
if (endParenthesis > -1 && !book.Substring(parenthesis + 1, endParenthesis - parenthesis).Contains(' '))
var endParenthesis = book.IndexOf(')', parenthesis);
if (endParenthesis == -1 || !book.Substring(parenthesis + 1, endParenthesis - parenthesis).Contains(' '))
{
parenthesis = -1;
}

Loading…
Cancel
Save