From cc6c6c3d3e23ed824308deecc058e8e59fe84509 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 7 Jul 2020 12:49:22 +0200 Subject: [PATCH] Added todo message to PrefixlessBodyModelValidatorAttribute Signed-off-by: Bjarke Berg --- .../Filters/PrefixlessBodyModelValidatorAttribute.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Filters/PrefixlessBodyModelValidatorAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/PrefixlessBodyModelValidatorAttribute.cs index 36cc241976..840149ef14 100644 --- a/src/Umbraco.Web.BackOffice/Filters/PrefixlessBodyModelValidatorAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/PrefixlessBodyModelValidatorAttribute.cs @@ -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 /// 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)