diff --git a/services/webdav/pkg/service/v0/service.go b/services/webdav/pkg/service/v0/service.go index 8e9757fd38..598728044b 100644 --- a/services/webdav/pkg/service/v0/service.go +++ b/services/webdav/pkg/service/v0/service.go @@ -45,6 +45,11 @@ var ( } ) +// register the REPORT method at init so it cannot race with concurrent route setup in other services. +func init() { + chi.RegisterMethod("REPORT") +} + // Service defines the extension handlers. type Service interface { ServeHTTP(w http.ResponseWriter, r *http.Request) @@ -93,9 +98,6 @@ func NewService(opts ...Option) (Service, error) { svc.thumbnailsClient = nil } - // register method with chi before any routing is set up - chi.RegisterMethod("REPORT") - m.Route(options.Config.HTTP.Root, func(r chi.Router) { if !svc.config.DisablePreviews {