Prevent a tag from being an alias of itself in tag creation

This commit is contained in:
2025-05-30 20:09:05 +08:00
parent d6c6bf943e
commit 1d3aee3b70

View File

@@ -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
}