Register notFound handler only once per root router (#6926)

registering notFound handler more than once causes
gorilla mux to return error for all registered paths
greater than > 8. This might be a bug in the gorilla/mux
but we shouldn't be using it this way. NotFound handler
should be only registered once per root router.

Fixes #6915
This commit is contained in:
Harshavardhana 2018-12-05 11:54:12 -08:00 committed by kannappanr
parent 4e6d3c093f
commit 8fcc787cba

View File

@ -377,7 +377,7 @@ func registerStorageRESTHandlers(router *mux.Router, endpoints EndpointList) {
Queries(restQueries(storageRESTVolume, storageRESTFilePath)...)
subrouter.Methods(http.MethodPost).Path("/" + storageRESTMethodRenameFile).HandlerFunc(httpTraceHdrs(server.RenameFileHandler)).
Queries(restQueries(storageRESTSrcVolume, storageRESTSrcPath, storageRESTDstVolume, storageRESTDstPath)...)
subrouter.NotFoundHandler = http.HandlerFunc(httpTraceAll(notFoundHandler))
}
router.NotFoundHandler = http.HandlerFunc(httpTraceAll(notFoundHandler))
}