mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-14 06:05:32 +01:00
fix(fileserver): correct middleware handler to avoid self recursion
This commit is contained in:
@@ -71,8 +71,9 @@ func (s *FileServer) Start(parent task.Parent) gperr.Error {
|
||||
}
|
||||
|
||||
if s.middleware != nil {
|
||||
next := s.handler
|
||||
s.handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
s.middleware.ServeHTTP(s.handler.ServeHTTP, w, r)
|
||||
s.middleware.ServeHTTP(next.ServeHTTP, w, r)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user