From 115ca115714b5215e10f65cf902599dd84b25fd4 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 23 Jul 2021 17:54:25 +0800 Subject: [PATCH 1/2] Fix issue pasted image missing if no release permission --- 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 d06a7fc88e2a4..b6ca6bd730f0a 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) + // for compitable 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) From 128ea64eb29a783a47d3da0199c65094b3e4df74 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 23 Jul 2021 23:49:37 +0800 Subject: [PATCH 2/2] Update routers/web/web.go Co-authored-by: zeripath --- routers/web/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index b6ca6bd730f0a..26e6c31a47091 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -830,7 +830,7 @@ func RegisterRoutes(m *web.Route) { }, ignSignIn, context.RepoAssignment, context.UnitTypes(), reqRepoReleaseReader) - // for compitable old attachments + // to maintain compatibility with old attachments m.Group("/{username}/{reponame}", func() { m.Get("/attachments/{uuid}", repo.GetAttachment) }, ignSignIn, context.RepoAssignment, context.UnitTypes())