From 6004dee58cb3c86686ff49d78178ec2bfb5c5a30 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 29 May 2024 19:31:56 +0800 Subject: [PATCH 1/2] fix --- routers/web/web.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routers/web/web.go b/routers/web/web.go index 6a17c19821df..3131c9906b5b 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1125,6 +1125,9 @@ func registerRoutes(m *web.Route) { // user/org home, including rss feeds m.Get("/{username}/{reponame}", ignSignIn, context.RepoAssignment, context.RepoRef(), repo.SetEditorconfigIfExists, repo.Home) + // TODO: maybe it should relax the permission to allow "any access" + m.Post("/{username}/{reponame}/markup", ignSignIn, context.RepoAssignment, context.RequireRepoReaderOr(unit.TypeCode, unit.TypeIssues, unit.TypePullRequests, unit.TypeWiki), web.Bind(structs.MarkupOption{}), misc.Markup) + m.Group("/{username}/{reponame}", func() { m.Get("/find/*", repo.FindFiles) m.Group("/tree-list", func() { @@ -1236,8 +1239,6 @@ func registerRoutes(m *web.Route) { m.Post("/reactions/{action}", web.Bind(forms.ReactionForm{}), repo.ChangeCommentReaction) }, context.RepoMustNotBeArchived()) - m.Post("/markup", web.Bind(structs.MarkupOption{}), misc.Markup) - m.Group("/labels", func() { m.Post("/new", web.Bind(forms.CreateLabelForm{}), repo.NewLabel) m.Post("/edit", web.Bind(forms.CreateLabelForm{}), repo.UpdateLabel) From b48d9d0d041430cbb4d6d7451e40610097044a92 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 29 May 2024 21:38:56 +0800 Subject: [PATCH 2/2] add unit.TypeReleases --- 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 3131c9906b5b..5fb1ce0e8036 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1126,7 +1126,7 @@ func registerRoutes(m *web.Route) { m.Get("/{username}/{reponame}", ignSignIn, context.RepoAssignment, context.RepoRef(), repo.SetEditorconfigIfExists, repo.Home) // TODO: maybe it should relax the permission to allow "any access" - m.Post("/{username}/{reponame}/markup", ignSignIn, context.RepoAssignment, context.RequireRepoReaderOr(unit.TypeCode, unit.TypeIssues, unit.TypePullRequests, unit.TypeWiki), web.Bind(structs.MarkupOption{}), misc.Markup) + m.Post("/{username}/{reponame}/markup", ignSignIn, context.RepoAssignment, context.RequireRepoReaderOr(unit.TypeCode, unit.TypeIssues, unit.TypePullRequests, unit.TypeReleases, unit.TypeWiki), web.Bind(structs.MarkupOption{}), misc.Markup) m.Group("/{username}/{reponame}", func() { m.Get("/find/*", repo.FindFiles)