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