From 24d42e6bd174890b63dbeeb1728ab8993ef5dbd4 Mon Sep 17 00:00:00 2001 From: Claus Date: Wed, 3 Feb 2016 15:02:44 +0100 Subject: [PATCH] Fixes: U4-7691 7.4 beta - Document composition is not working with media types Media type compositions weren't getting added since it only looked up through the content type service. --- .../Models/Mapping/ContentTypeModelMapperExtensions.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapperExtensions.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapperExtensions.cs index 431357d5f2..9773c63c79 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapperExtensions.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapperExtensions.cs @@ -69,7 +69,12 @@ namespace Umbraco.Web.Models.Mapping foreach (var a in add) { //TODO: Remove N+1 lookup - var addCt = applicationContext.Services.ContentTypeService.GetContentType(a); + //since we don't really know from the alias what type of content type this is, + //we look up by content type first and then by media type if not found. + //content type aliases are unique so this should be safe to do. + IContentTypeComposition addCt = applicationContext.Services.ContentTypeService.GetContentType(a); + if (addCt == null) + addCt = applicationContext.Services.ContentTypeService.GetMediaType(a); if (addCt != null) dest.AddContentType(addCt); }