diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index fd18c03c37..ac31fedacb 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -91,14 +91,14 @@ namespace Umbraco.Web.Trees //we need to verify that the user has access to view this node, otherwise we'll render an empty tree collection // TODO: in the future we could return a validation statement so we can have some UI to notify the user they don't have access if (HasPathAccess(id, queryStrings)) - { - nodes = PerformGetTreeNodes(id, queryStrings); + { + nodes = GetTreeNodesInternal(id, queryStrings); } } else { //load normally - nodes = PerformGetTreeNodes(id, queryStrings); + nodes = GetTreeNodesInternal(id, queryStrings); } //only render the recycle bin if we are not in dialog and the start id id still the root @@ -121,6 +121,20 @@ namespace Umbraco.Web.Trees return nodes; } + return GetTreeNodesInternal(id, queryStrings); + } + + /// + /// Before we make a call to get the tree nodes we have to check if they can actually be rendered + /// + /// + /// + /// + /// + /// Currently this just checks if it is a container type, if it is we cannot render children. In the future this might check for other things. + /// + private TreeNodeCollection GetTreeNodesInternal(string id, FormDataCollection queryStrings) + { //before we get the children we need to see if this is a container node var current = Services.EntityService.Get(int.Parse(id), UmbracoObjectType); if (current != null && current.AdditionalData.ContainsKey("IsContainer") && current.AdditionalData["IsContainer"] is bool && (bool)current.AdditionalData["IsContainer"]) diff --git a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs index bc67e46207..36170627d9 100644 --- a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs @@ -51,12 +51,10 @@ namespace Umbraco.Web.WebApi.Filters public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { + if (actionExecutedContext.Response == null) return; + var user = UmbracoContext.Current.Security.CurrentUser; - if (user == null) - { - base.OnActionExecuted(actionExecutedContext); - return; - } + if (user == null) return; var objectContent = actionExecutedContext.Response.Content as ObjectContent; if (objectContent != null)