Added todo message to PrefixlessBodyModelValidatorAttribute

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-07-07 12:49:22 +02:00
parent 610bbee245
commit cc6c6c3d3e

View File

@@ -1,8 +1,6 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Umbraco.Web.BackOffice.Filters
{
@@ -11,6 +9,10 @@ namespace Umbraco.Web.BackOffice.Filters
/// </summary>
public class PrefixlessBodyModelValidatorAttribute : TypeFilterAttribute
{
//TODO: Could be a better solution to replace the IModelValidatorProvider and ensure the errors are created
//without the prefix, instead of removing it afterwards. But I couldn't find any way to do this for only some
//of the controllers. IObjectModelValidator seems to be the interface to implement and replace in the container
//to handle it for the entire solution.
public PrefixlessBodyModelValidatorAttribute() : base(typeof(PrefixlessBodyModelValidatorFilter))
{
}
@@ -26,8 +28,6 @@ namespace Umbraco.Web.BackOffice.Filters
if (context.ModelState.IsValid) return;
//Remove prefix from errors
foreach (var modelStateItem in context.ModelState)
{
foreach (var prefix in context.ActionArguments.Keys)