Skip to content

Commit 949a7e7

Browse files
lunnyGiteaBot
andcommitted
Fix users cannot visit issue attachment bug (go-gitea#25019)
Caused by go-gitea#24362 Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 95bf09f commit 949a7e7

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

routers/web/repo/attachment.go

-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ func GetAttachment(ctx *context.Context) {
110110
return
111111
}
112112
} else { // If we have the repository we check access
113-
context.CheckRepoScopedToken(ctx, repository)
114-
if ctx.Written() {
115-
return
116-
}
117-
118113
perm, err := access_model.GetUserRepoPermission(ctx, repository, ctx.Doer)
119114
if err != nil {
120115
ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err.Error())

tests/integration/attachment_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func TestCreateIssueAttachment(t *testing.T) {
8989
// Validate that attachment is available
9090
req = NewRequest(t, "GET", "/attachments/"+uuid)
9191
session.MakeRequest(t, req, http.StatusOK)
92+
93+
// anonymous visit should be allowed because user2/repo1 is a public repository
94+
MakeRequest(t, req, http.StatusOK)
9295
}
9396

9497
func TestGetAttachment(t *testing.T) {

0 commit comments

Comments
 (0)