From eb082b8d024f978356ebd240b01c5288ae89e89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A2=A8=E9=9B=AA?= Date: Tue, 18 Aug 2026 10:40:36 +0800 Subject: [PATCH] fix(audit): errors.Is for subscription not-found path --- backend/internal/router/subscription.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/internal/router/subscription.go b/backend/internal/router/subscription.go index 1435c8a..49b8670 100644 --- a/backend/internal/router/subscription.go +++ b/backend/internal/router/subscription.go @@ -1,6 +1,7 @@ package router import ( + "errors" "net/http" "strings" "time" @@ -39,10 +40,10 @@ func subscriptionHandler(db *gorm.DB, cfg *config.Config) gin.HandlerFunc { return } raw, err = converter.GenerateRawConfig(db, access, c.Request) - } else if err == gorm.ErrRecordNotFound { + } else if errors.Is(err, gorm.ErrRecordNotFound) { var pu models.ProxyUser if err = db.Where("sub_token = ?", tok).First(&pu).Error; err != nil { - if err == gorm.ErrRecordNotFound { + if errors.Is(err, gorm.ErrRecordNotFound) { c.JSON(http.StatusNotFound, gin.H{"error": "subscription not found"}) return }