From 17483d31fee85f247ec297e2d4cbe2bea376b9a9 Mon Sep 17 00:00:00 2001 From: Asai Neko Date: Wed, 11 Feb 2026 21:47:25 +0800 Subject: [PATCH] Enforce update nickname Signed-off-by: Asai Neko --- service/service_user/update_user_info.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/service/service_user/update_user_info.go b/service/service_user/update_user_info.go index 3e4b19c..109b0b9 100644 --- a/service/service_user/update_user_info.go +++ b/service/service_user/update_user_info.go @@ -39,7 +39,25 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U } if payload.Data.Nickname != nil { - if utf8.RuneCountInString(*payload.Data.Nickname) > 24 { + val := *payload.Data.Nickname + if val == "" { + execption := new(exception.Builder). + SetStatus(exception.StatusUser). + SetService(exception.ServiceUser). + SetType(exception.TypeCommon). + SetOriginal(exception.CommonErrorInvalidInput) + + result = &UserInfoResult{ + Common: shared.CommonResult{ + HttpCode: 400, + Exception: execption, + }, + Data: nil, + } + + return + } + if utf8.RuneCountInString(val) > 24 { execption := new(exception.Builder). SetStatus(exception.StatusUser). SetService(exception.ServiceUser).