Handle the case where the editorvalue is from the db and just is a path. (#16429)

This commit is contained in:
Bjarke Berg
2024-05-28 15:27:23 +02:00
committed by GitHub
parent 2a9808c776
commit 23461b3698

View File

@@ -154,6 +154,14 @@ internal class FileUploadPropertyValueEditor : DataValueEditor
return null;
}
if (editorValue is string sourceString && sourceString.DetectIsJson() is false)
{
return new FileUploadValue()
{
Src = sourceString
};
}
return _jsonSerializer.TryDeserialize(editorValue, out FileUploadValue? modelValue)
? modelValue
: throw new ArgumentException($"Could not parse editor value to a {nameof(FileUploadValue)} object.");