From ed0aa7f14ab30035ac2f7e642e59bb7061e57ed3 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 20 Dec 2019 09:55:03 +0000 Subject: [PATCH] Use DetectIsJson string extension as opposed to a horrible try/catch --- .../Views/Partials/Grid/Editors/Embed.cshtml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml index 866d3d2bdd..4a915a444b 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml @@ -1,12 +1,8 @@ @model dynamic @using Umbraco.Web.Templates @{ - var embedValue = string.Empty; - try { - embedValue = Model.value.preview; - } catch(Exception ex) { - embedValue = Model.value; - } + string embedValue = Convert.ToString(Model.value); + embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value; }