From 427d9a560435307c62534ec33611324c45e2a574 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 26 May 2020 15:33:18 +0800 Subject: [PATCH] Handle the case where customErrorMessageSet is true. --- .../Mvc/Validation/ValidationAttributeHelper.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs index 8d5a7abfb1..14ff42e320 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs @@ -20,13 +20,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation { validationAttribute.ErrorMessage = "The field {0} must be a string with a minimum length of {2} and a maximum length of {1}."; + return; } } - else - { - validationAttribute.ErrorMessage = - ValidationAttributeErrorMessageStringProperty.GetValue(validationAttribute) as string; - } + + validationAttribute.ErrorMessage = + ValidationAttributeErrorMessageStringProperty.GetValue(validationAttribute) as string; } } }