From 848e8a62480ef56dcf9d3b0bd9862ee6d8e7b4cd Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 9 Dec 2014 19:30:48 +0100 Subject: [PATCH] Fixes U4-5986 Compositions: Possible to get stuck in document type ysod's #U4-5986 Fixed Due in version 7.2.1 --- .../umbraco/create/nodetypeTasks.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs index 07c33f3dc4..04e0f45851 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs @@ -24,13 +24,18 @@ namespace umbraco //NOTE: TypeID is the parent id! //NOTE: ParentID is aparently a flag to determine if we are to create a template! Hack much ?! :P var parentId = TypeID != 0 ? TypeID : -1; - var contentType = parentId == -1 - ? new ContentType(-1) - : new ContentType(ApplicationContext.Current.Services.ContentTypeService.GetContentType(parentId)); - contentType.CreatorId = User.Id; + // when creating a content type, enforce PascalCase // preserve separator because contentType.Alias will re-alias it - contentType.Alias = Alias.ToCleanString(CleanStringType.Alias | CleanStringType.PascalCase, ' '); + var cleanAlias = Alias.ToCleanString(CleanStringType.Alias | CleanStringType.PascalCase, ' '); + + var contentType = parentId == -1 + ? new ContentType(-1) + : new ContentType(ApplicationContext.Current.Services.ContentTypeService.GetContentType(parentId), cleanAlias); + + contentType.CreatorId = User.Id; + + contentType.Alias = cleanAlias; contentType.Name = Alias.Replace("'", "''"); contentType.Icon = ".sprTreeFolder";