From 04b04029f405d20b23f2f271d8bb66875abbd087 Mon Sep 17 00:00:00 2001 From: Sai Asish Y Date: Tue, 12 May 2026 13:30:02 -0700 Subject: [PATCH] fix(webdav): register chi REPORT method in init to avoid race with concurrent route setup --- services/webdav/pkg/service/v0/service.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 {