diff options
| author | gnattu <gnattu@users.noreply.github.com> | 2024-05-01 03:32:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-30 13:32:49 -0600 |
| commit | 5dc6bb4910cfdc7f40ad83d647172d743e6e0595 (patch) | |
| tree | 6832f1398d67d5f43a75e171967879a81ed38744 | |
| parent | 48bb16472f7ed62ee74c98a51dea3bf3ee135de2 (diff) | |
Fix incomplete tag query for whitelist tags (#11416)
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteItemRepository.cs | 14 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/ItemsController.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 0a8a36ebc..e3015095c 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -4202,7 +4202,19 @@ namespace Emby.Server.Implementations.Data { int index = 0; string includedTags = string.Join(',', query.IncludeInheritedTags.Select(_ => paramName + index++)); - whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null)"); + // 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)"); + } } else { diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.cs index 6ffe6e7da..70f805336 100644 --- a/Jellyfin.Api/Controllers/ItemsController.cs +++ b/Jellyfin.Api/Controllers/ItemsController.cs @@ -256,6 +256,13 @@ public class ItemsController : BaseJellyfinApiController 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 } .AddClientFields(User) .AddAdditionalDtoOptions(enableImages, enableUserData, imageTypeLimit, enableImageTypes); diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index adbbbaa03..6c9097689 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1610,7 +1610,7 @@ namespace MediaBrowser.Controller.Entities } var parent = GetParents().FirstOrDefault() ?? this; - if (parent is UserRootFolder) + if (parent is UserRootFolder or AggregateFolder) { return true; } |
