From 83eb193f1bbd7e7d247e94c79f195602360f84a3 Mon Sep 17 00:00:00 2001 From: huiyifyj Date: Tue, 1 Apr 2025 16:26:31 +0800 Subject: [PATCH] fix UseWithCtx method to check for nil context - Add nil check for context parameter. - UseWithCtx method return explicit type rather than interface. Replace base64Captcha.Store return type with *RedisStore for better type safety. --- server/utils/captcha/redis.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/utils/captcha/redis.go b/server/utils/captcha/redis.go index a13b7cc11..ffb4dbf78 100644 --- a/server/utils/captcha/redis.go +++ b/server/utils/captcha/redis.go @@ -5,7 +5,6 @@ import ( "time" "github.com/flipped-aurora/gin-vue-admin/server/global" - "github.com/mojocn/base64Captcha" "go.uber.org/zap" ) @@ -23,8 +22,10 @@ type RedisStore struct { Context context.Context } -func (rs *RedisStore) UseWithCtx(ctx context.Context) base64Captcha.Store { - rs.Context = ctx +func (rs *RedisStore) UseWithCtx(ctx context.Context) *RedisStore { + if ctx == nil { + rs.Context = ctx + } return rs }