From ac2638194f052a6a31917c1b92f0c576c1cfc2ab Mon Sep 17 00:00:00 2001 From: talhamalik4025 <105341627+talhamalik4025@users.noreply.github.com> Date: Fri, 24 Jul 2026 14:31:07 +0500 Subject: [PATCH] Fix saving file-based editors (image cropper, media picker, file upload) inside a block The inner ContentPropertyData was created without a ContentKey or PropertyTypeKey, so property editors that store files against the content key (Image Cropper, MediaPicker3, File Upload) received Guid.Empty and threw "Invalid content key" on save. Set both keys before calling the inner FromEditor, mirroring Umbraco core's BlockValuePropertyValueEditorBase. Fixes #102 --- .../PropertyEditor/ContentBlocksValueEditor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Perplex.ContentBlocks.Core/PropertyEditor/ContentBlocksValueEditor.cs b/src/Perplex.ContentBlocks.Core/PropertyEditor/ContentBlocksValueEditor.cs index d42acc3b..c56ca1a3 100644 --- a/src/Perplex.ContentBlocks.Core/PropertyEditor/ContentBlocksValueEditor.cs +++ b/src/Perplex.ContentBlocks.Core/PropertyEditor/ContentBlocksValueEditor.cs @@ -117,7 +117,11 @@ void FromEditor(BlockItemData? data) continue; } - var propData = new ContentPropertyData(prop.Value, configuration); + var propData = new ContentPropertyData(prop.Value, configuration) + { + ContentKey = editorValue.ContentKey, + PropertyTypeKey = prop.PropertyType.Key, + }; prop.Value = valueEditor.FromEditor(propData, prop.Value); } }