Closed bjarnef closed 1 year ago
I am working on a project which has a block with an Embed property (textstring), which contains an URL to a YouTube video. When switching the the OEmbed property editor (single) the PVC breaks.
It could use the DetectIsJson() method to ensure this is valid JSON before trying deserialize and inside that also use JsonConvert.DeserializeObject in try of a try/catch block: https://github.com/dawoe/OEmbed-Picker-Property-Editor/blob/develop/src/Dawoe.OEmbedPickerPropertyEditor.Core/ValueConverters/OEmbedPickerValueConverter.cs#L63
DetectIsJson()
JsonConvert.DeserializeObject
try/catch
E.g. like on some JSON based core PVC: https://github.com/umbraco/Umbraco-CMS/blob/5bfab13dc5a268714aad2426a2b68ab5561a6407/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/GridValueConverter.cs#L43-L47
I am working on a project which has a block with an Embed property (textstring), which contains an URL to a YouTube video. When switching the the OEmbed property editor (single) the PVC breaks.
It could use the
DetectIsJson()
method to ensure this is valid JSON before trying deserialize and inside that also useJsonConvert.DeserializeObject
in try of atry/catch
block: https://github.com/dawoe/OEmbed-Picker-Property-Editor/blob/develop/src/Dawoe.OEmbedPickerPropertyEditor.Core/ValueConverters/OEmbedPickerValueConverter.cs#L63E.g. like on some JSON based core PVC: https://github.com/umbraco/Umbraco-CMS/blob/5bfab13dc5a268714aad2426a2b68ab5561a6407/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/GridValueConverter.cs#L43-L47