Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API for edit and delete release attachment #8290

Merged
merged 2 commits into from
Sep 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add logging for when user requested attachment doesn't belong to the …
…specified release.
  • Loading branch information
davidsvantesson committed Sep 26, 2019
commit e6d8010ef27cdd8805f65e78c67b035cffc9b231
4 changes: 4 additions & 0 deletions routers/api/v1/repo/release_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"

api "code.gitea.io/gitea/modules/structs"
Expand Down Expand Up @@ -57,6 +58,7 @@ func GetReleaseAttachment(ctx *context.APIContext) {
return
}
if attach.ReleaseID != releaseID {
log.Info("User requested attachment is not in release, release_id %v, attachment_id: %v", releaseID, attachID)
ctx.NotFound()
return
}
Expand Down Expand Up @@ -263,6 +265,7 @@ func EditReleaseAttachment(ctx *context.APIContext, form api.EditAttachmentOptio
return
}
if attach.ReleaseID != releaseID {
log.Info("User requested attachment is not in release, release_id %v, attachment_id: %v", releaseID, attachID)
ctx.NotFound()
return
}
Expand Down Expand Up @@ -320,6 +323,7 @@ func DeleteReleaseAttachment(ctx *context.APIContext) {
return
}
if attach.ReleaseID != releaseID {
log.Info("User requested attachment is not in release, release_id %v, attachment_id: %v", releaseID, attachID)
ctx.NotFound()
return
}
Expand Down