adding . applying filter
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.PublishedCache;
|
||||
using Umbraco.Cms.Web.BackOffice.Controllers;
|
||||
using Umbraco.Cms.Web.Common.Attributes;
|
||||
using Umbraco.Cms.Web.Common.Filters;
|
||||
using Umbraco.Extensions;
|
||||
using Constants = Umbraco.Cms.Core.Constants;
|
||||
|
||||
@@ -33,6 +34,8 @@ namespace Umbraco.Cms.Web.BackOffice.PropertyEditors
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
[AllowHttpJsonConfigration]
|
||||
public IEnumerable<TagModel> GetTags(string tagGroup, string culture, string query = null)
|
||||
{
|
||||
if (culture == string.Empty) culture = null;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Umbraco.Cms.Web.Common.Formatters;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Filters
|
||||
{
|
||||
public class AllowHttpJsonConfigrationAttribute : TypeFilterAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// This filter overwrites AngularJsonOnlyConfigurationAttribute and get the api back to its defualt behavior
|
||||
/// </summary>
|
||||
public AllowHttpJsonConfigrationAttribute() : base(typeof(AllowJsonXHRConfigrationFilter))
|
||||
{
|
||||
Order = 2; // this value must be more than the AngularJsonOnlyConfigurationAttribute on order to overwrtie it
|
||||
}
|
||||
|
||||
private class AllowJsonXHRConfigrationFilter : IResultFilter
|
||||
{
|
||||
public void OnResultExecuted(ResultExecutedContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext context)
|
||||
{
|
||||
if (context.Result is ObjectResult objectResult)
|
||||
{
|
||||
objectResult.Formatters.RemoveType<AngularJsonMediaTypeFormatter>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user