From e0d1267f7bcd2f779922949d5ea9229712b12b51 Mon Sep 17 00:00:00 2001 From: Sven Geusens Date: Mon, 17 Feb 2025 15:27:22 +0100 Subject: [PATCH 1/3] Loosen the RTEValue datacontract to improve migrations (#18349) --- .../Models/RichTextEditorValue.cs | 2 +- .../RichTextPropertyEditorHelperTests.cs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/Models/RichTextEditorValue.cs b/src/Umbraco.Infrastructure/Models/RichTextEditorValue.cs index 9904ea33bb..cf64747ec2 100644 --- a/src/Umbraco.Infrastructure/Models/RichTextEditorValue.cs +++ b/src/Umbraco.Infrastructure/Models/RichTextEditorValue.cs @@ -10,5 +10,5 @@ public class RichTextEditorValue public required string Markup { get; set; } [DataMember(Name = "blocks")] - public required RichTextBlockValue? Blocks { get; set; } + public RichTextBlockValue? Blocks { get; set; } } diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/RichTextPropertyEditorHelperTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/RichTextPropertyEditorHelperTests.cs index 8d2d59337f..ab68db550f 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/RichTextPropertyEditorHelperTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/RichTextPropertyEditorHelperTests.cs @@ -94,6 +94,22 @@ public class RichTextPropertyEditorHelperTests }); } + [Test] + public void Can_Parse_JObject_With_Missing_Blocks() + { + var input = JsonNode.Parse("""" + { + "markup": "

Vælg et af vores mest populære produkter

" + } + """"); + + var result = RichTextPropertyEditorHelper.TryParseRichTextEditorValue(input, JsonSerializer(), Logger(), out RichTextEditorValue? value); + Assert.IsTrue(result); + Assert.IsNotNull(value); + Assert.AreEqual("

Vælg et af vores mest populære produkter

", value.Markup); + Assert.IsNull(value.Blocks); + } + [Test] public void Can_Parse_Blocks_With_Both_Content_And_Settings() { From 3a753f431737d89c69c59de837f769df2bf79e34 Mon Sep 17 00:00:00 2001 From: Sven Geusens Date: Tue, 18 Feb 2025 13:57:31 +0100 Subject: [PATCH 2/3] Bump version --- src/Umbraco.Web.UI.Client/package-lock.json | 4 ++-- src/Umbraco.Web.UI.Client/package.json | 2 +- version.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index d42c1dab93..cd83278097 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -1,12 +1,12 @@ { "name": "@umbraco-cms/backoffice", - "version": "15.2.0-rc", + "version": "15.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@umbraco-cms/backoffice", - "version": "15.2.0-rc", + "version": "15.2.2", "license": "MIT", "workspaces": [ "./src/packages/*" diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index ed634f0456..385ebf0bc1 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -1,7 +1,7 @@ { "name": "@umbraco-cms/backoffice", "license": "MIT", - "version": "15.2.0-rc", + "version": "15.2.2", "type": "module", "exports": { ".": null, diff --git a/version.json b/version.json index 1264b7fef2..abd1405138 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "15.2.1", + "version": "15.2.2", "assemblyVersion": { "precision": "build" }, From c198e192da544330db2b2962272ac86a96a95fb6 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 19 Feb 2025 06:51:05 +0100 Subject: [PATCH 3/3] Modified AspNetCoreRequestAccessor to handle absensce of an HttpContext. --- .../AspNetCore/AspNetCoreRequestAccessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs index 6e6de49521..ca548586a1 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreRequestAccessor.cs @@ -34,7 +34,7 @@ public class AspNetCoreRequestAccessor : IRequestAccessor, IDisposable public string? GetRequestValue(string name) => GetFormValue(name) ?? GetQueryStringValue(name); /// - public string? GetQueryStringValue(string name) => _httpContextAccessor.GetRequiredHttpContext().Request.Query[name]; + public string? GetQueryStringValue(string name) => _httpContextAccessor.HttpContext?.Request.Query[name]; /// public Uri? GetRequestUrl() => _httpContextAccessor.HttpContext != null @@ -86,8 +86,8 @@ public class AspNetCoreRequestAccessor : IRequestAccessor, IDisposable private string? GetFormValue(string name) { - HttpRequest request = _httpContextAccessor.GetRequiredHttpContext().Request; - if (!request.HasFormContentType) + HttpRequest? request = _httpContextAccessor.HttpContext?.Request; + if (request?.HasFormContentType is not true) { return null; }