]> source.dussan.org Git - gitea.git/commitdiff
Fix issue pasted image missing if no release permission (#16520) (#16527)
authorLunny Xiao <xiaolunwen@gmail.com>
Sat, 24 Jul 2021 16:34:57 +0000 (00:34 +0800)
committerGitHub <noreply@github.com>
Sat, 24 Jul 2021 16:34:57 +0000 (18:34 +0200)
* Fix issue pasted image missing if no release permission

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
routers/web/web.go

index 9baef52962c9d62c3ad8ea43838833bcead131d2..d8b4a0eebc6dfe5eadc84cb15485fa4c6f9e284f 100644 (file)
@@ -822,9 +822,14 @@ func RegisterRoutes(m *web.Route) {
                        }
                        ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
                })
-               m.Get("/attachments/{uuid}", repo.GetAttachment)
+
        }, ignSignIn, context.RepoAssignment, context.UnitTypes(), reqRepoReleaseReader)
 
+       // to maintain compatibility with old attachments
+       m.Group("/{username}/{reponame}", func() {
+               m.Get("/attachments/{uuid}", repo.GetAttachment)
+       }, ignSignIn, context.RepoAssignment, context.UnitTypes())
+
        m.Group("/{username}/{reponame}", func() {
                m.Post("/topics", repo.TopicsPost)
        }, context.RepoAssignment, context.RepoMustNotBeArchived(), reqRepoAdmin)