mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-09 18:13:10 +02:00
Backport #16496 Unfortunately the chi changes have resulted in the CORS headers for the git smart http protocol going missing. This is mostly because the OPTIONS method is not being handled by httpBase anymore. This PR adds a GetOptions, PostOptions and Options methods to web handler to allow OPTIONS method requests to still reach the httpBase function. Fix #16350 Close #16491 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
1 parent
cf9aeca508
commit
1f5011dff7
2 files changed
+31
-11
No files matched your search
+11
-11
@@ -1006,17 +1006,17 @@ func RegisterRoutes(m *web.Route) {
|
||||
}, ignSignInAndCsrf, lfsServerEnabled)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Post("/git-upload-pack", repo.ServiceUploadPack)
|
||||
m.Post("/git-receive-pack", repo.ServiceReceivePack)
|
||||
m.Get("/info/refs", repo.GetInfoRefs)
|
||||
m.Get("/HEAD", repo.GetTextFile("HEAD"))
|
||||
m.Get("/objects/info/alternates", repo.GetTextFile("objects/info/alternates"))
|
||||
m.Get("/objects/info/http-alternates", repo.GetTextFile("objects/info/http-alternates"))
|
||||
m.Get("/objects/info/packs", repo.GetInfoPacks)
|
||||
m.Get("/objects/info/{file:[^/]*}", repo.GetTextFile(""))
|
||||
m.Get("/objects/{head:[0-9a-f]{2}}/{hash:[0-9a-f]{38}}", repo.GetLooseObject)
|
||||
m.Get("/objects/pack/pack-{file:[0-9a-f]{40}}.pack", repo.GetPackFile)
|
||||
m.Get("/objects/pack/pack-{file:[0-9a-f]{40}}.idx", repo.GetIdxFile)
|
||||
m.PostOptions("/git-upload-pack", repo.ServiceUploadPack)
|
||||
m.PostOptions("/git-receive-pack", repo.ServiceReceivePack)
|
||||
m.GetOptions("/info/refs", repo.GetInfoRefs)
|
||||
m.GetOptions("/HEAD", repo.GetTextFile("HEAD"))
|
||||
m.GetOptions("/objects/info/alternates", repo.GetTextFile("objects/info/alternates"))
|
||||
m.GetOptions("/objects/info/http-alternates", repo.GetTextFile("objects/info/http-alternates"))
|
||||
m.GetOptions("/objects/info/packs", repo.GetInfoPacks)
|
||||
m.GetOptions("/objects/info/{file:[^/]*}", repo.GetTextFile(""))
|
||||
m.GetOptions("/objects/{head:[0-9a-f]{2}}/{hash:[0-9a-f]{38}}", repo.GetLooseObject)
|
||||
m.GetOptions("/objects/pack/pack-{file:[0-9a-f]{40}}.pack", repo.GetPackFile)
|
||||
m.GetOptions("/objects/pack/pack-{file:[0-9a-f]{40}}.idx", repo.GetIdxFile)
|
||||
}, ignSignInAndCsrf)
|
||||
|
||||
m.Head("/tasks/trigger", repo.TriggerTask)
|
||||
|
||||
Reference in new issue
Block a user