mirror of
https://github.com/minio/minio.git
synced 2025-04-04 03:40:30 -04:00
Fix missing error check for jsonrpc.Server.RegisterService() (#2921)
This commit is contained in:
parent
eb372d53df
commit
31be826f51
@ -101,7 +101,9 @@ func configureServerHandler(srvCmdConfig serverCmdConfig) (http.Handler, error)
|
|||||||
// set environmental variable MINIO_BROWSER=off to disable minio web browser.
|
// set environmental variable MINIO_BROWSER=off to disable minio web browser.
|
||||||
// By default minio web browser is enabled.
|
// By default minio web browser is enabled.
|
||||||
if !strings.EqualFold(os.Getenv("MINIO_BROWSER"), "off") {
|
if !strings.EqualFold(os.Getenv("MINIO_BROWSER"), "off") {
|
||||||
registerWebRouter(mux)
|
if err = registerWebRouter(mux); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add API router.
|
// Add API router.
|
||||||
|
@ -58,7 +58,7 @@ func assetFS() *assetfs.AssetFS {
|
|||||||
const specialAssets = "loader.css|logo.svg|firefox.png|safari.png|chrome.png|favicon.ico"
|
const specialAssets = "loader.css|logo.svg|firefox.png|safari.png|chrome.png|favicon.ico"
|
||||||
|
|
||||||
// registerWebRouter - registers web router for serving minio browser.
|
// registerWebRouter - registers web router for serving minio browser.
|
||||||
func registerWebRouter(mux *router.Router) {
|
func registerWebRouter(mux *router.Router) error {
|
||||||
// Initialize Web.
|
// Initialize Web.
|
||||||
web := &webAPIHandlers{
|
web := &webAPIHandlers{
|
||||||
ObjectAPI: newObjectLayerFn,
|
ObjectAPI: newObjectLayerFn,
|
||||||
@ -74,7 +74,11 @@ func registerWebRouter(mux *router.Router) {
|
|||||||
webRPC := jsonrpc.NewServer()
|
webRPC := jsonrpc.NewServer()
|
||||||
webRPC.RegisterCodec(codec, "application/json")
|
webRPC.RegisterCodec(codec, "application/json")
|
||||||
webRPC.RegisterCodec(codec, "application/json; charset=UTF-8")
|
webRPC.RegisterCodec(codec, "application/json; charset=UTF-8")
|
||||||
webRPC.RegisterService(web, "Web")
|
|
||||||
|
// Register RPC handlers with server
|
||||||
|
if err := webRPC.RegisterService(web, "Web"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// RPC handler at URI - /minio/webrpc
|
// RPC handler at URI - /minio/webrpc
|
||||||
webBrowserRouter.Methods("POST").Path("/webrpc").Handler(webRPC)
|
webBrowserRouter.Methods("POST").Path("/webrpc").Handler(webRPC)
|
||||||
@ -89,4 +93,6 @@ func registerWebRouter(mux *router.Router) {
|
|||||||
|
|
||||||
// Serve index.html for rest of the requests.
|
// Serve index.html for rest of the requests.
|
||||||
webBrowserRouter.Path("/{index:.*}").Handler(indexHandler{http.StripPrefix(reservedBucket, http.FileServer(assetFS()))})
|
webBrowserRouter.Path("/{index:.*}").Handler(indexHandler{http.StripPrefix(reservedBucket, http.FileServer(assetFS()))})
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user