mirror of https://github.com/Radarr/Radarr
Fixed: SQL error searching for movie by name
This commit is contained in:
parent
32a6c9fe2a
commit
5c9b85972d
|
@ -169,6 +169,16 @@ namespace NzbDrone.Core.Test.Datastore
|
|||
_subject.ToString().Should().Be($"((\"Movies\".\"CleanTitle\" = @Clause1_P1) AND (\"Movies\".\"Id\" IN (1, 2, 3)))");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void where_in_string_list()
|
||||
{
|
||||
var list = new List<string> { "first", "second", "third" };
|
||||
|
||||
_subject = Where(x => list.Contains(x.CleanTitle));
|
||||
|
||||
_subject.ToString().Should().Be($"(\"Movies\".\"CleanTitle\" IN @Clause1_P1)");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void enum_as_int()
|
||||
{
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace NzbDrone.Core.Datastore
|
|||
{
|
||||
var list = expression.Object;
|
||||
|
||||
if (list != null && (list.Type == typeof(string) || list.Type == typeof(List<string>)))
|
||||
if (list != null && (list.Type == typeof(string)))
|
||||
{
|
||||
ParseStringContains(expression);
|
||||
return;
|
||||
|
|
|
@ -101,8 +101,9 @@ namespace NzbDrone.Core.Movies
|
|||
|
||||
public List<Movie> FindByTitles(List<string> titles)
|
||||
{
|
||||
return Query(Builder().OrWhere<Movie>(x => titles.Contains(x.CleanTitle))
|
||||
.OrWhere<AlternativeTitle>(x => titles.Contains(x.CleanTitle)));
|
||||
var distinct = titles.Distinct().ToList();
|
||||
return Query(Builder().OrWhere<Movie>(x => distinct.Contains(x.CleanTitle))
|
||||
.OrWhere<AlternativeTitle>(x => distinct.Contains(x.CleanTitle)));
|
||||
}
|
||||
|
||||
public List<Movie> FindByTitleInexact(string cleanTitle)
|
||||
|
|
Loading…
Reference in New Issue