mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Special characters removed from titles
#ND-128 fixed Fixed: Remove special characters from titles when searching
This commit is contained in:
parent
1596e8530f
commit
e2cc4ef4ea
@ -56,5 +56,20 @@ public void should_replace_ampersand_with_and()
|
||||
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
|
||||
.Should().Be("Franklin and Bash");
|
||||
}
|
||||
|
||||
[TestCase("Betty White's Off Their Rockers", "Betty Whites Off Their Rockers")]
|
||||
[TestCase("Star Wars: The Clone Wars", "Star Wars The Clone Wars")]
|
||||
[TestCase("Hawaii Five-0", "Hawaii Five-0")]
|
||||
public void should_replace_some_special_characters(string input, string expected)
|
||||
{
|
||||
_series.Title = input;
|
||||
|
||||
Mocker.GetMock<SceneMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(_series.SeriesId))
|
||||
.Returns("");
|
||||
|
||||
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
|
||||
.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
@ -174,6 +175,7 @@ public virtual string GetSearchTitle(Series series, int seasonNumber = -1)
|
||||
{
|
||||
title = series.Title;
|
||||
title = title.Replace("&", "and");
|
||||
title = Regex.Replace(title, @"[^\w\d\s\-]", "");
|
||||
}
|
||||
|
||||
return title;
|
||||
|
Loading…
Reference in New Issue
Block a user