From 78613823aebf4dbfb384b49444562304bef2c5b3 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 13 May 2014 15:22:16 +1000 Subject: [PATCH] Fixes: U4-4853 Richtext Editor doesn't render macros after upgrade to Umbraco 6.2.0 --- src/Umbraco.Web/umbraco.presentation/macro.cs | 9 +++++++++ .../umbraco.presentation/umbraco/nodeFactory/Node.cs | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index 49e49b592f..3fa50ded67 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -354,6 +354,9 @@ namespace umbraco } catch (Exception e) { + LogHelper.WarnWithException( + "Error loading partial view macro (View: " + Model.ScriptName + ")", true, e); + renderFailed = true; Exceptions.Add(e); macroControl = handleError(e); @@ -1824,6 +1827,12 @@ namespace umbraco public static string MacroContentByHttp(int PageID, Guid PageVersion, Hashtable attributes) { + + if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted) + { + return "Cannot render macro content in the rich text editor when the application is running in a Partial Trust environment"; + } + string tempAlias = (attributes["macroalias"] != null) ? attributes["macroalias"].ToString() : attributes["macroAlias"].ToString(); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs index 7d614795bc..8ea7dcddbb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs @@ -550,7 +550,13 @@ namespace umbraco.NodeFactory { if (HttpContext.Current.Items["pageID"] == null) throw new InvalidOperationException("There is no current node."); - return (int)HttpContext.Current.Items["pageID"]; + + var intAttempt = HttpContext.Current.Items["pageID"].TryConvertTo(); + if (intAttempt == false) + { + throw new InvalidOperationException("The pageID value in the HttpContext.Items cannot be converted to an integer"); + } + return intAttempt.Result; } } } \ No newline at end of file