From 1d3aee3b7011075460c0a12c130c9868fbd6c405 Mon Sep 17 00:00:00 2001 From: nyne Date: Fri, 30 May 2025 20:09:05 +0800 Subject: [PATCH] Prevent a tag from being an alias of itself in tag creation --- server/service/tag.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/service/tag.go b/server/service/tag.go index d4a7eeb..5c8ec2f 100644 --- a/server/service/tag.go +++ b/server/service/tag.go @@ -83,6 +83,9 @@ func SetTagInfo(uid uint, id uint, description string, aliasOf *uint, tagType st if !canUpload { return nil, model.NewUnAuthorizedError("User cannot set tag description") } + if aliasOf != nil && *aliasOf == id { + return nil, model.NewRequestError("Tag cannot be an alias of itself") + } if err := dao.SetTagInfo(id, description, aliasOf, tagType); err != nil { return nil, err }