Fix projected relations mixed with normal relations

This commit is contained in:
Zoe Roux 2023-12-05 00:43:02 +01:00
parent 7ccfab4d8b
commit e5dde472c9

View File

@ -36,6 +36,7 @@ using Kyoo.Abstractions.Models.Utils;
using Kyoo.Authentication; using Kyoo.Authentication;
using Kyoo.Utils; using Kyoo.Utils;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
namespace Kyoo.Core.Controllers; namespace Kyoo.Core.Controllers;
@ -131,7 +132,10 @@ public static class DapperHelper
T Map(T item, IEnumerable<object?> relations) T Map(T item, IEnumerable<object?> relations)
{ {
foreach ((string name, object? value) in include.Fields.Zip(relations)) IEnumerable<string> metadatas = include.Metadatas
.Where(x => x is not Include.ProjectedRelation)
.Select(x => x.Name);
foreach ((string name, object? value) in metadatas.Zip(relations))
{ {
if (value == null) if (value == null)
continue; continue;