U4-9237 Validate application parameter when getting application trees (#2315)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
8666b222ac
commit
b09bf518c6
@@ -3,7 +3,9 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -32,6 +34,8 @@ namespace Umbraco.Web.Trees
|
||||
[HttpQueryStringFilter("queryStrings")]
|
||||
public async Task<SectionRootNode> GetApplicationTrees(string application, string tree, FormDataCollection queryStrings, bool onlyInitialized = true)
|
||||
{
|
||||
application = application.CleanForXss();
|
||||
|
||||
if (string.IsNullOrEmpty(application)) throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
|
||||
var rootId = Constants.System.Root.ToString(CultureInfo.InvariantCulture);
|
||||
@@ -39,7 +43,7 @@ namespace Umbraco.Web.Trees
|
||||
//find all tree definitions that have the current application alias
|
||||
var appTrees = Services.ApplicationTreeService.GetApplicationTrees(application, onlyInitialized).ToArray();
|
||||
|
||||
if (string.IsNullOrEmpty(tree) == false || appTrees.Length == 1)
|
||||
if (string.IsNullOrEmpty(tree) == false || appTrees.Length == 1 || appTrees.Any() == false)
|
||||
{
|
||||
var apptree = string.IsNullOrEmpty(tree) == false
|
||||
? appTrees.SingleOrDefault(x => x.Alias == tree)
|
||||
|
||||
Reference in New Issue
Block a user