summaryrefslogtreecommitdiffstats
path: root/routers/repo/attachment.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/attachment.go')
-rw-r--r--routers/repo/attachment.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go
index 96dc28a23a..f938c230ed 100644
--- a/routers/repo/attachment.go
+++ b/routers/repo/attachment.go
@@ -70,14 +70,14 @@ func UploadAttachment(ctx *context.Context) {
func DeleteAttachment(ctx *context.Context) {
file := ctx.Query("file")
attach, err := models.GetAttachmentByUUID(file)
- if !ctx.IsSigned || (ctx.User.ID != attach.UploaderID) {
- ctx.Error(403)
- return
- }
if err != nil {
ctx.Error(400, err.Error())
return
}
+ if !ctx.IsSigned || (ctx.User.ID != attach.UploaderID) {
+ ctx.Error(403)
+ return
+ }
err = models.DeleteAttachment(attach, true)
if err != nil {
ctx.Error(500, fmt.Sprintf("DeleteAttachment: %v", err))