From 89f680aa047ec29ad9b3e0fa07c351f622cb1a95 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 25 Jul 2021 00:34:57 +0800 Subject: [PATCH] Fix issue pasted image missing if no release permission (#16520) (#16527) * Fix issue pasted image missing if no release permission Co-authored-by: zeripath Co-authored-by: 6543 <6543@obermui.de> --- routers/web/web.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index 9baef5296..d8b4a0eeb 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -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)