mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Prevent a tag from being an alias of itself in tag creation
This commit is contained in:
@@ -83,6 +83,9 @@ func SetTagInfo(uid uint, id uint, description string, aliasOf *uint, tagType st
|
|||||||
if !canUpload {
|
if !canUpload {
|
||||||
return nil, model.NewUnAuthorizedError("User cannot set tag description")
|
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 {
|
if err := dao.SetTagInfo(id, description, aliasOf, tagType); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user