diff --git a/src/Umbraco.Web.UI/umbraco/developer/Macros/EditMacro.aspx.cs b/src/Umbraco.Web.UI/umbraco/developer/Macros/EditMacro.aspx.cs index faa356e177..39b7e7d4a5 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Macros/EditMacro.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/developer/Macros/EditMacro.aspx.cs @@ -33,8 +33,9 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Macros { base.PopulateFieldsOnLoad(macro, macroAssemblyValue, macroTypeValue); //check if the ScriptingFile property contains the MacroPartials path - if (macro.ScriptingFile.StartsWith(SystemDirectories.MvcViews + "/MacroPartials/") - || (Regex.IsMatch(macro.ScriptingFile, "~/App_Plugins/.+?/Views/MacroPartials", RegexOptions.Compiled))) + if (!macro.ScriptingFile.IsNullOrWhiteSpace() + && (macro.ScriptingFile.StartsWith(SystemDirectories.MvcViews + "/MacroPartials/") + || (Regex.IsMatch(macro.ScriptingFile, "~/App_Plugins/.+?/Views/MacroPartials", RegexOptions.Compiled)))) { macroPython.Text = ""; SelectedPartialView.Text = macro.ScriptingFile; diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config index 0e0a90365f..157ac6289d 100644 --- a/src/Umbraco.Web.UI/web.Template.Debug.config +++ b/src/Umbraco.Web.UI/web.Template.Debug.config @@ -21,4 +21,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config index 8f3cf391d7..4ad6ba0817 100644 --- a/src/Umbraco.Web.UI/web.Template.config +++ b/src/Umbraco.Web.UI/web.Template.config @@ -264,8 +264,9 @@ - - + + + @@ -273,7 +274,22 @@ - + + + + + + + + + + + + + + + + diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs index 28e558e358..8fd5960e74 100644 --- a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs +++ b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs @@ -12,6 +12,7 @@ using Umbraco.Core.IO; using umbraco.cms.businesslogic.macro; using umbraco.interfaces; using Umbraco.Web.Mvc; +using Umbraco.Core; namespace Umbraco.Web.Macros { @@ -90,7 +91,8 @@ namespace Umbraco.Web.Macros { if (macro == null) throw new ArgumentNullException("macro"); if (currentPage == null) throw new ArgumentNullException("currentPage"); - + if (macro.ScriptName.IsNullOrWhiteSpace()) throw new ArgumentException("The ScriptName property of the macro object cannot be null or empty"); + if (!macro.ScriptName.StartsWith(SystemDirectories.MvcViews + "/MacroPartials/") && (!Regex.IsMatch(macro.ScriptName, "~/App_Plugins/.+?/Views/MacroPartials", RegexOptions.Compiled))) {