Fix incomplete tag query for whitelist tags (#11416)
This commit is contained in:
parent
48bb16472f
commit
5dc6bb4910
|
@ -4202,8 +4202,20 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
string includedTags = string.Join(',', query.IncludeInheritedTags.Select(_ => paramName + index++));
|
string includedTags = string.Join(',', query.IncludeInheritedTags.Select(_ => paramName + index++));
|
||||||
|
// Episodes do not store inherit tags from their parents in the database, and the tag may be still required by the client.
|
||||||
|
// In addtion to the tags for the episodes themselves, we need to manually query its parent (the season)'s tags as well.
|
||||||
|
if (includeTypes.Length == 1 && includeTypes.FirstOrDefault() is BaseItemKind.Episode)
|
||||||
|
{
|
||||||
|
whereClauses.Add($"""
|
||||||
|
((select CleanValue from ItemValues where ItemId=Guid and Type=6 and CleanValue in ({includedTags})) is not null
|
||||||
|
OR (select CleanValue from ItemValues where ItemId=ParentId and Type=6 and CleanValue in ({includedTags})) is not null)
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null)");
|
whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null)");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int index = 0; index < query.IncludeInheritedTags.Length; index++)
|
for (int index = 0; index < query.IncludeInheritedTags.Length; index++)
|
||||||
|
|
|
@ -256,6 +256,13 @@ public class ItemsController : BaseJellyfinApiController
|
||||||
return BadRequest("userId is required");
|
return BadRequest("userId is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user is not null
|
||||||
|
&& user.GetPreference(PreferenceKind.AllowedTags).Length != 0
|
||||||
|
&& !fields.Contains(ItemFields.Tags))
|
||||||
|
{
|
||||||
|
fields = [..fields, ItemFields.Tags];
|
||||||
|
}
|
||||||
|
|
||||||
var dtoOptions = new DtoOptions { Fields = fields }
|
var dtoOptions = new DtoOptions { Fields = fields }
|
||||||
.AddClientFields(User)
|
.AddClientFields(User)
|
||||||
.AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
|
.AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes);
|
||||||
|
|
|
@ -1610,7 +1610,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = GetParents().FirstOrDefault() ?? this;
|
var parent = GetParents().FirstOrDefault() ?? this;
|
||||||
if (parent is UserRootFolder)
|
if (parent is UserRootFolder or AggregateFolder)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user