From bd8d7b91d62fc035dc6f01fedae166e6aa9e1d4c Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Wed, 8 Sep 2021 12:07:05 +0200 Subject: [PATCH] Support plain file path strings as Image Cropper values --- .../ImageCropperPropertyEditor.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs index b33e4fd6d8..95023cecf6 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ImageCropperPropertyEditor.cs @@ -167,10 +167,23 @@ namespace Umbraco.Cms.Core.PropertyEditors { deserializedValue = null; if (propVal == null || !(propVal is string str)) return null; - if (!str.DetectIsJson()) return null; - deserializedValue = GetJObject(str, true); + + if (!str.DetectIsJson()) + { + // Assume the value is a plain string with the file path + deserializedValue = new JObject() + { + { "src", str } + }; + } + else + { + deserializedValue = GetJObject(str, true); + } + if (deserializedValue?["src"] == null) return null; var src = deserializedValue["src"].Value(); + return relative ? _mediaFileManager.FileSystem.GetRelativePath(src) : src; }