diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 44f05f161..5e50e19a3 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -280,6 +280,7 @@ public void should_find_result_if_multiple_books_in_searchcriteria() [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); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 90254aac4..9c07bef2c 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -413,7 +413,7 @@ public static ParsedBookInfo ParseBookTitleWithSearchCriteria(string title, Auth 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 @@ public static (string, string) SplitBookTitle(this string book, string author) 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; }