Wire up the search service at the old webdav endpoint

This commit is contained in:
André Duffeck
2022-07-06 15:58:26 +02:00
parent ee97594742
commit 4f042aa071
2 changed files with 11 additions and 5 deletions
+2 -1
View File
@@ -113,7 +113,8 @@ func NewService(opts ...Option) (Service, error) {
// back to using `chi.RegisterMethod`.
m.MethodNotAllowed(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
routePrefix := path.Join(options.Config.HTTP.Root, "/remote.php/dav/files/")
if req.Method == "REPORT" && strings.HasPrefix(req.URL.Path, routePrefix) {
legacyRoutePrefix := path.Join(options.Config.HTTP.Root, "/remote.php/webdav")
if req.Method == "REPORT" && (strings.HasPrefix(req.URL.Path, routePrefix) || strings.HasPrefix(req.URL.Path, legacyRoutePrefix)) {
// The URLParam will not be available here. If it is needed it
// needs to be passed manually or chi needs to be fixed
// To use it properly.