Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v15.2 - Can't save a document when rich text is used in a block on a page with a culture #18252

Closed
john-funnell opened this issue Feb 6, 2025 · 12 comments

Comments

@john-funnell
Copy link

john-funnell commented Feb 6, 2025

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

15.2.0

Bug summary

We've upgraded to v15.2 today and now editors can't save pages that have a rich text editor in a block grid. I've tried with both TinyMce and TipTap but the error always happens.

This is the exception that is logged.

System.Text.Json.JsonException: The converter 'System.Text.Json.Serialization.Converters.CastingConverter`1[Umbraco.Cms.Core.Models.Blocks.RichTextBlockValue]' read too much or not enough. Path: $ | LineNumber: 0 | BytePositionInLine: 113.
   at System.Text.Json.ThrowHelper.ThrowJsonException_SerializationConverterRead(JsonConverter converter)
   at System.Text.Json.Serialization.JsonConverter`1.VerifyRead(JsonTokenType tokenType, Int32 depth, Int64 bytesConsumed, Boolean isValueConverter, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
   at Umbraco.Cms.Infrastructure.Serialization.SystemTextJsonSerializerBase.Deserialize[T](String input)
   at Umbraco.Cms.Core.Models.Blocks.BlockEditorDataConverter`2.Deserialize(String json)
   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.MergeVariantInvariantPropertyValue(Object sourceValue, Object targetValue, Boolean canUpdateInvariantData, HashSet`1 allowedCultures)
   at Umbraco.Cms.Core.PropertyEditors.RichTextPropertyEditor.MergeVariantInvariantPropertyValue(Object sourceValue, Object targetValue, Boolean canUpdateInvariantData, HashSet`1 allowedCultures)
   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.CleanupVariantValues(List`1 sourceBlockItems, List`1 targetBlockItems, Boolean canUpdateInvariantData, HashSet`1 allowedCultures)
   at Umbraco.Cms.Core.PropertyEditors.BlockValuePropertyValueEditorBase`2.MergeVariantInvariantPropertyValue(Object sourceValue, Object targetValue, Boolean canUpdateInvariantData, HashSet`1 allowedCultures)
   at Umbraco.Cms.Core.PropertyEditors.BlockGridPropertyEditor.MergeVariantInvariantPropertyValue(Object sourceValue, Object targetValue, Boolean canUpdateInvariantData, HashSet`1 allowedCultures)
   at Umbraco.Cms.Core.Services.ContentEditingService.EnsureOnlyAllowedFieldsAreUpdated(IContent contentWithPotentialUnallowedChanges, Guid userKey)
   at Umbraco.Cms.Core.Services.ContentEditingService.UpdateAsync(Guid key, ContentUpdateModel updateModel, Guid userKey)
   at Umbraco.Cms.Api.Management.Controllers.Document.UpdateDocumentController.<>c__DisplayClass4_0.<<Update>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Api.Management.Controllers.Document.UpdateDocumentControllerBase.HandleRequest(Guid id, UpdateDocumentRequestModel requestModel, Func`1 authorizedHandler)
   at Umbraco.Cms.Api.Management.Controllers.Document.UpdateDocumentController.Update(CancellationToken cancellationToken, Guid id, UpdateDocumentRequestModel requestModel)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Api.Management.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cloud.Cms.PublicAccess.Middleware.CloudPublicAccessMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Deploy.Infrastructure.Middleware.BearerTokenAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 112
   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

Specifics

No response

Steps to reproduce

  1. Create a doc type and vary by culture
  2. Create a block grid with a block that has a rich text editor.
  3. Create the content using the doc type and block grid
  4. Try and save

Expected result / actual result

Expected result

To be able to save a page with a rich text editor on

Expected result

An exception is thrown

Copy link

github-actions bot commented Feb 6, 2025

Hi there @john-funnell!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@mjpraxis
Copy link
Contributor

mjpraxis commented Feb 6, 2025

@john-funnell we are also running 15.2.0 and have several elements with RTE TinyMCE property in Block Grids.
And it work as expected.

We have upgraded our websites with all version since v14-beta incl release-candidates.

What version did you upgrade from -> v15.2 ?

@john-funnell
Copy link
Author

We upgraded from 15.1.2. I've tried it with a brand new page and as soon as I add a rich text block I can no longer save the page. This also happens with existing pages which were fine yesterday.

@john-funnell
Copy link
Author

After a bit of digging I've found the page saves successfully on some doc types. When inspecting the network request I can see the save request succeeds when the culture is null but fails when it's set to 'en-US'.

Image

Image

@john-funnell john-funnell changed the title v15.2 - Can't save a document when rich text is used in a block grid v15.2 - Can't save a document when rich text is used in a block on a page with a culture Feb 6, 2025
@john-funnell
Copy link
Author

I can confirm that this error doesn't happen when vary by culture is set to false. I've updated the title and description to reflect this

@nul800sebastiaan
Copy link
Member

This sounds like the same error as here: #17753

@john-funnell
Copy link
Author

It looks similar but it is different. The other bug is related to custom validation. This is when a rich text editor is used. We can't even save the document. This was working fine on 15.0 and 15.1 but now we get this error.

Image

@Zeegaan Zeegaan self-assigned this Feb 7, 2025
@Zeegaan
Copy link
Member

Zeegaan commented Feb 7, 2025

Looking into it, I can reproduce this, sadly this is a regression 😢
Thanks for reporting this quickly, we are looking into it 🕵

@arknu
Copy link
Contributor

arknu commented Feb 11, 2025

@Zeegaan This looks like a duplicate of #18174, which I reported for the RC. Sadly my report was not taken seriously and 15.2 released with this bug.

@Zeegaan
Copy link
Member

Zeegaan commented Feb 11, 2025

Hey @arknu that issue was fixed in #18085 for the final v15.2 😁

@arknu
Copy link
Contributor

arknu commented Feb 11, 2025

@Zeegaan No, I specifically also reported that fixing the initial issue then would cause this JSON error. To quote myself:

This fix is still not enough, as now the RTE breaks trying to read the blocks JSON. I haven't dug too much into this, but the cause seems to be that it is trying to read the whole JSON value (including the markup property, instead of only reading the blocks property.

I hadn't actually noticed that my original issue was (somewhat) fixed in 15.2, it seems it was only closed just now...

@Zeegaan
Copy link
Member

Zeegaan commented Feb 11, 2025

This is fixed in #18290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants