Skip to content

Commit 04771b5

Browse files
authored
Allow users with write permissions for issues to add attachments with API (#26837)
Fixes #24944 Since a user with write permissions for issues can add attachments to an issue via the the web interface, the user should also be able to add attachments via the API
1 parent 02efd99 commit 04771b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: routers/api/v1/repo/issue_attachment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func getIssueAttachmentSafeRead(ctx *context.APIContext, issue *issues_model.Iss
344344
}
345345

346346
func canUserWriteIssueAttachment(ctx *context.APIContext, issue *issues_model.Issue) bool {
347-
canEditIssue := ctx.IsSigned && (ctx.Doer.ID == issue.PosterID || ctx.IsUserRepoAdmin() || ctx.IsUserSiteAdmin()) && ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)
347+
canEditIssue := ctx.IsSigned && (ctx.Doer.ID == issue.PosterID || ctx.IsUserRepoAdmin() || ctx.IsUserSiteAdmin() || ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull))
348348
if !canEditIssue {
349349
ctx.Error(http.StatusForbidden, "", "user should have permission to write issue")
350350
return false

0 commit comments

Comments
 (0)