Skip to content

Clean up null values in datatype configs#16296

Merged
Migaroez merged 2 commits into
v14/devfrom
v14/fix/clean-up-empty-datatype-configurations
May 21, 2024
Merged

Clean up null values in datatype configs#16296
Migaroez merged 2 commits into
v14/devfrom
v14/fix/clean-up-empty-datatype-configurations

Conversation

@kjac

@kjac kjac commented May 15, 2024

Copy link
Copy Markdown
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

We're seeing null values for datatype configurations when migration older (V11?) databases to V14. It mostly seem to happen for empty array configurations, and it looks like the System.Text.Json serializer doesn't know what to do with those.

This is not happening for V13 databases. It seems like V13 does not store empty array config values.

The null values are particularly problematic for the default file upload editor (with no allowed types configured). The editor expects a non-nullable array of allowed file extensions, but the stored config value is null and thus the array is initialized with a null value during deserialization. The result is a fine error message when attempting to upload a new file:

image

To fix it, this PR adds a new migration to root out all null value configuration entries for all core datatypes.

Testing this PR

It's a little tricky to test since it only happens in certain rare cases. But reach out to @kjac for a test DB and some instructions 😄

kjac and others added 2 commits May 15, 2024 11:35
…tions

# Conflicts:
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs

@Migaroez Migaroez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works as expected after merging in dev 👍

@Migaroez Migaroez merged commit 5a75488 into v14/dev May 21, 2024
@Migaroez Migaroez deleted the v14/fix/clean-up-empty-datatype-configurations branch May 21, 2024 07:50
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