@@ -276,14 +276,16 @@ func Routes() *web.Route {
276276 return routes
277277}
278278
279+ var ignSignInAndCsrf = verifyAuthWithOptions (& common.VerifyOptions {DisableCSRF : true })
280+
279281// registerRoutes register routes
280282func registerRoutes (m * web.Route ) {
281283 reqSignIn := verifyAuthWithOptions (& common.VerifyOptions {SignInRequired : true })
282284 reqSignOut := verifyAuthWithOptions (& common.VerifyOptions {SignOutRequired : true })
283285 // TODO: rename them to "optSignIn", which means that the "sign-in" could be optional, depends on the VerifyOptions (RequireSignInView)
284286 ignSignIn := verifyAuthWithOptions (& common.VerifyOptions {SignInRequired : setting .Service .RequireSignInView })
285287 ignExploreSignIn := verifyAuthWithOptions (& common.VerifyOptions {SignInRequired : setting .Service .RequireSignInView || setting .Service .Explore .RequireSigninView })
286- ignSignInAndCsrf := verifyAuthWithOptions ( & common. VerifyOptions { DisableCSRF : true })
288+
287289 validation .AddBindingRules ()
288290
289291 linkAccountEnabled := func (ctx * context.Context ) {
@@ -1512,19 +1514,7 @@ func registerRoutes(m *web.Route) {
15121514 })
15131515 }, ignSignInAndCsrf , lfsServerEnabled )
15141516
1515- m .Group ("" , func () {
1516- m .PostOptions ("/git-upload-pack" , repo .ServiceUploadPack )
1517- m .PostOptions ("/git-receive-pack" , repo .ServiceReceivePack )
1518- m .GetOptions ("/info/refs" , repo .GetInfoRefs )
1519- m .GetOptions ("/HEAD" , repo .GetTextFile ("HEAD" ))
1520- m .GetOptions ("/objects/info/alternates" , repo .GetTextFile ("objects/info/alternates" ))
1521- m .GetOptions ("/objects/info/http-alternates" , repo .GetTextFile ("objects/info/http-alternates" ))
1522- m .GetOptions ("/objects/info/packs" , repo .GetInfoPacks )
1523- m .GetOptions ("/objects/info/{file:[^/]*}" , repo .GetTextFile ("" ))
1524- m .GetOptions ("/objects/{head:[0-9a-f]{2}}/{hash:[0-9a-f]{38}}" , repo .GetLooseObject )
1525- m .GetOptions ("/objects/pack/pack-{file:[0-9a-f]{40}}.pack" , repo .GetPackFile )
1526- m .GetOptions ("/objects/pack/pack-{file:[0-9a-f]{40}}.idx" , repo .GetIdxFile )
1527- }, ignSignInAndCsrf , repo .HTTPGitEnabledHandler , repo .CorsHandler (), context_service .UserAssignmentWeb ())
1517+ gitHTTPRouters (m )
15281518 })
15291519 })
15301520 // ***** END: Repository *****
0 commit comments