diff options
Diffstat (limited to 'routers/api/v1/repo/release_attachment.go')
-rw-r--r-- | routers/api/v1/repo/release_attachment.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/api/v1/repo/release_attachment.go b/routers/api/v1/repo/release_attachment.go index f352c10829..51e1b160da 100644 --- a/routers/api/v1/repo/release_attachment.go +++ b/routers/api/v1/repo/release_attachment.go @@ -9,6 +9,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/convert" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" @@ -62,7 +63,7 @@ func GetReleaseAttachment(ctx *context.APIContext) { return } // FIXME Should prove the existence of the given repo, but results in unnecessary database requests - ctx.JSON(http.StatusOK, attach.APIFormat()) + ctx.JSON(http.StatusOK, convert.ToReleaseAttachment(attach)) } // ListReleaseAttachments lists all attachments of the release @@ -107,7 +108,7 @@ func ListReleaseAttachments(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "LoadAttributes", err) return } - ctx.JSON(http.StatusOK, release.APIFormat().Attachments) + ctx.JSON(http.StatusOK, convert.ToRelease(release).Attachments) } // CreateReleaseAttachment creates an attachment and saves the given file @@ -203,7 +204,7 @@ func CreateReleaseAttachment(ctx *context.APIContext) { return } - ctx.JSON(http.StatusCreated, attach.APIFormat()) + ctx.JSON(http.StatusCreated, convert.ToReleaseAttachment(attach)) } // EditReleaseAttachment updates the given attachment @@ -267,7 +268,7 @@ func EditReleaseAttachment(ctx *context.APIContext, form api.EditAttachmentOptio if err := models.UpdateAttachment(attach); err != nil { ctx.Error(http.StatusInternalServerError, "UpdateAttachment", attach) } - ctx.JSON(http.StatusCreated, attach.APIFormat()) + ctx.JSON(http.StatusCreated, convert.ToReleaseAttachment(attach)) } // DeleteReleaseAttachment delete a given attachment |