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)