From df703e4664c3369d371fc7de2c7820b4cdceab2d Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Tue, 12 Dec 2023 16:19:08 +0800 Subject: [PATCH] Opt: room login roomid err resp --- server/model/room.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/model/room.go b/server/model/room.go index 42ac998..97cd2c4 100644 --- a/server/model/room.go +++ b/server/model/room.go @@ -80,8 +80,10 @@ func (l *LoginRoomReq) Decode(ctx *gin.Context) error { } func (l *LoginRoomReq) Validate() error { - if len(l.RoomId) != 32 { + if l.RoomId == "" { return ErrEmptyRoomName + } else if len(l.RoomId) != 32 { + return errors.New("invalid room id") } return nil