From ce9c5d4d97742731f30406e66857072521fb2744 Mon Sep 17 00:00:00 2001 From: RaZaSB Date: Sun, 11 Aug 2024 16:46:02 +0100 Subject: [PATCH] New: Remove all single quote characters from searches (cherry picked from commit 0877a6718d3df8e217a72cc5b113b8398e495eb1) --- .../IndexerSearchTests/SearchDefinitionFixture.cs | 4 ++++ .../IndexerSearch/Definitions/SearchCriteriaBase.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs b/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs index 6ec88ac3d..132cffaa0 100644 --- a/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs @@ -15,6 +15,10 @@ namespace NzbDrone.Core.Test.IndexerSearchTests [TestCase("Franklin & Bash", "Franklin+and+Bash")] [TestCase("Chicago P.D.", "Chicago+PD")] [TestCase("Kourtney And Khlo\u00E9 Take The Hamptons", "Kourtney+And+Khloe+Take+The+Hamptons")] + [TestCase("Betty White`s Off Their Rockers", "Betty+Whites+Off+Their+Rockers")] + [TestCase("Betty White\u00b4s Off Their Rockers", "Betty+Whites+Off+Their+Rockers")] + [TestCase("Betty White‘s Off Their Rockers", "Betty+Whites+Off+Their+Rockers")] + [TestCase("Betty White’s Off Their Rockers", "Betty+Whites+Off+Their+Rockers")] public void should_replace_some_special_characters(string input, string expected) { Subject.SceneTitles = new List { input }; diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs index 7d7219150..aeb4d7803 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions { public abstract class SearchCriteriaBase { - private static readonly Regex SpecialCharacter = new Regex(@"[`'.]", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex SpecialCharacter = new Regex(@"['.\u0060\u00B4\u2018\u2019]", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex NonWord = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex BeginningThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);