fix(webdav): register chi REPORT method in init to avoid race with concurrent route setup
This commit is contained in:
committed by
Ralf Haferkamp
parent
5d7bfc9033
commit
8b48501082
@@ -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.
|
// Service defines the extension handlers.
|
||||||
type Service interface {
|
type Service interface {
|
||||||
ServeHTTP(w http.ResponseWriter, r *http.Request)
|
ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||||
@@ -93,9 +98,6 @@ func NewService(opts ...Option) (Service, error) {
|
|||||||
svc.thumbnailsClient = nil
|
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) {
|
m.Route(options.Config.HTTP.Root, func(r chi.Router) {
|
||||||
|
|
||||||
if !svc.config.DisablePreviews {
|
if !svc.config.DisablePreviews {
|
||||||
|
|||||||
Reference in New Issue
Block a user