diff --git a/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs b/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs index 00708fb439..b1847c80da 100644 --- a/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs +++ b/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs @@ -1,4 +1,4 @@ -using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Models.ContentTypeEditing; using Umbraco.Cms.Core.Services.OperationStatus; using Umbraco.Cms.Core.Strings; @@ -407,7 +407,7 @@ internal abstract class ContentTypeEditingServiceBase _contentTypeService.GetAllContentTypeAliases().Contains(alias); + private bool ContentTypeAliasIsInUse(string alias) => _contentTypeService.GetAllContentTypeAliases().InvariantContains(alias); private bool ContentTypeAliasCanBeUsedFor(string alias, Guid key) { diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentTypeEditingServiceTests.Create.cs b/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentTypeEditingServiceTests.Create.cs index 814d1b5be7..a987e9a4f7 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentTypeEditingServiceTests.Create.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentTypeEditingServiceTests.Create.cs @@ -861,14 +861,15 @@ internal sealed partial class ContentTypeEditingServiceTests Assert.AreEqual(ContentTypeOperationStatus.InvalidAlias, result.Status); } - [Test] - public async Task Cannot_Use_Existing_Alias() + [TestCase("test")] // Matches alias case sensitively. + [TestCase("Test")] // Matches alias case insensitively. + public async Task Cannot_Use_Existing_Alias(string newAlias) { var createModel = ContentTypeCreateModel("Test", "test"); var result = await ContentTypeEditingService.CreateAsync(createModel, Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); - createModel = ContentTypeCreateModel("Test 2", "test"); + createModel = ContentTypeCreateModel("Test 2", newAlias); result = await ContentTypeEditingService.CreateAsync(createModel, Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentTypeOperationStatus.DuplicateAlias, result.Status);