fix(webdav): register chi REPORT method in init to avoid race with concurrent route setup

This commit is contained in:
Sai Asish Y
2026-05-12 13:30:02 -07:00
committed by Ralf Haferkamp
parent 5d7bfc9033
commit 8b48501082

View File

@@ -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 {