Skip to content

Relax block data contract#18349

Merged
AndyButland merged 1 commit intov15/devfrom
v15/fix/rte-block-data-contract
Feb 17, 2025
Merged

Relax block data contract#18349
AndyButland merged 1 commit intov15/devfrom
v15/fix/rte-block-data-contract

Conversation

@Migaroez
Copy link
Contributor

Description

#18275 is caused by

  • A very strict data contract
  • Data in the database that does not adhere to the contract

When the migration runs, part of the nested data fails to deserialize and to not make the entire migration fail, a message is logged and the data is cleared.
Since we currently have been unable to figure out how the malformed data has been entered trough the client and we think relaxing the data contract will not have any adverse effects, this pr does just that

Testing

I added a unit test that covers the change. You should be able to update the database manually to contain some problematic data. If not, feel free to reach out to obtain a database.

@Migaroez Migaroez requested a review from AndyButland February 17, 2025 12:37
Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test this I've:

  • Taken a V13 installation with a rich text field.
  • Manipulated the value in umbracoPropertyData to remove the blocks element from the stored JSON.
  • Upgraded to 15 using the current state of v15/dev
  • Found the markup removed and the following in the logs:
Could not parse rich text editor value, see exception for details.
System.Text.Json.JsonException: JSON deserialization for type 'Umbraco.Cms.Core.RichTextEditorValue' was missing required properties including: 'blocks'.
  • Repeated using the code from this PR and can confirm the markup is displayed in the RTE as expected.
  • When the content is saved the database is updated again with the empty blocks element.

@AndyButland AndyButland merged commit d87a84b into v15/dev Feb 17, 2025
22 checks passed
@AndyButland AndyButland deleted the v15/fix/rte-block-data-contract branch February 17, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants