From 54e76b74c4aa987596cd7922b369da16886ceca1 Mon Sep 17 00:00:00 2001 From: kjac Date: Thu, 2 Feb 2023 09:29:36 +0100 Subject: [PATCH] Handle unpublished, non-variant content --- .../Mapping/Content/ContentMapDefinition.cs | 2 +- .../Mapping/Document/DocumentMapDefinition.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Mapping/Content/ContentMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/Content/ContentMapDefinition.cs index 48e15b6da0..7d701069b1 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/Content/ContentMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/Content/ContentMapDefinition.cs @@ -48,7 +48,7 @@ public abstract class ContentMapDefinition propertyCollection.Values).ToArray(); var cultures = source.AvailableCultures.DefaultIfEmpty(null).ToArray(); - var segments = propertyValues.Select(property => property.Segment).Distinct().ToArray(); + var segments = propertyValues.Select(property => property.Segment).Distinct().DefaultIfEmpty(null).ToArray(); return cultures .SelectMany(culture => segments.Select(segment => diff --git a/src/Umbraco.Cms.Api.Management/Mapping/Document/DocumentMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/Document/DocumentMapDefinition.cs index fbfcbc13d3..6051a093ac 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/Document/DocumentMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/Document/DocumentMapDefinition.cs @@ -17,7 +17,6 @@ public class DocumentMapDefinition : ContentMapDefinition mapper.Define((_, _) => new DocumentViewModel(), Map); - // TODO: handle unpublished, non-variant content // Umbraco.Code.MapAll private void Map(IContent source, DocumentViewModel target, MapperContext context) {