properly register webdav methods with chi

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2023-07-31 17:38:15 +02:00
parent c4f32868ee
commit 21f52a8523
3 changed files with 17 additions and 57 deletions
+3 -7
View File
@@ -198,16 +198,12 @@ func (h *StaticRouteHandler) handler() http.Handler {
r.Post("/backchannel_logout", h.backchannelLogout)
// TODO: migrate oidc well knowns here in a second wrapper
// Send all requests to the proxy handler
r.HandleFunc("/*", h.proxy.ServeHTTP)
})
// This is commented out due to a race issue in chi
//var methods = []string{"PROPFIND", "DELETE", "PROPPATCH", "MKCOL", "COPY", "MOVE", "LOCK", "UNLOCK", "REPORT"}
//for _, k := range methods {
// chi.RegisterMethod(k)
//}
// To avoid using the chi.RegisterMethod() this is basically a catchAll for all HTTP Methods that are not
// covered in chi by default
// Also send requests for methods unknown to chi to the proxy handler as well
m.MethodNotAllowed(h.proxy.ServeHTTP)
return m
@@ -151,18 +151,9 @@ func DefaultPolicies() []config.Policy {
// TODO or we allow a REPORT on /dav/spaces to search all spaces and /dav/space/{spaceid} to search a specific space
// send webdav REPORT requests to search service
{
Type: config.RegexRoute,
Method: "REPORT",
Endpoint: "/remote.php/dav/",
Service: "com.owncloud.web.webdav",
},
{
Method: "REPORT",
Endpoint: "/remote.php/webdav",
Service: "com.owncloud.web.webdav",
},
{
Method: "REPORT",
Endpoint: "/dav/spaces",
Endpoint: "(/remote.php)?/(web)?dav",
Service: "com.owncloud.web.webdav",
},
{