From 9421bfedb35cfaa26cd1cd6e996e69a89fb8a87b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 24 Jul 2021 02:08:04 +0800 Subject: [PATCH] Fix issue pasted image missing if no release permission (#16520) * Fix issue pasted image missing if no release permission * Update routers/web/web.go Co-authored-by: zeripath 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 d06a7fc88e..26e6c31a47 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -827,9 +827,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)