|
|
|
@ -176,6 +176,8 @@ func CreateTag(ctx *context.APIContext) {
|
|
|
|
|
// "$ref": "#/responses/Tag"
|
|
|
|
|
// "404":
|
|
|
|
|
// "$ref": "#/responses/notFound"
|
|
|
|
|
// "405":
|
|
|
|
|
// "$ref": "#/responses/empty"
|
|
|
|
|
// "409":
|
|
|
|
|
// "$ref": "#/responses/conflict"
|
|
|
|
|
form := web.GetForm(ctx).(*api.CreateTagOption)
|
|
|
|
@ -196,6 +198,11 @@ func CreateTag(ctx *context.APIContext) {
|
|
|
|
|
ctx.Error(http.StatusConflict, "tag exist", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if models.IsErrProtectedTagName(err) {
|
|
|
|
|
ctx.Error(http.StatusMethodNotAllowed, "CreateNewTag", "user not allowed to create protected tag")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx.InternalServerError(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -236,6 +243,8 @@ func DeleteTag(ctx *context.APIContext) {
|
|
|
|
|
// "$ref": "#/responses/empty"
|
|
|
|
|
// "404":
|
|
|
|
|
// "$ref": "#/responses/notFound"
|
|
|
|
|
// "405":
|
|
|
|
|
// "$ref": "#/responses/empty"
|
|
|
|
|
// "409":
|
|
|
|
|
// "$ref": "#/responses/conflict"
|
|
|
|
|
tagName := ctx.Params("*")
|
|
|
|
@ -256,7 +265,12 @@ func DeleteTag(ctx *context.APIContext) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err = releaseservice.DeleteReleaseByID(ctx, tag.ID, ctx.Doer, true); err != nil {
|
|
|
|
|
if models.IsErrProtectedTagName(err) {
|
|
|
|
|
ctx.Error(http.StatusMethodNotAllowed, "delTag", "user not allowed to delete protected tag")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
ctx.Error(http.StatusInternalServerError, "DeleteReleaseByID", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx.Status(http.StatusNoContent)
|
|
|
|
|