From df0bce374c7cbadc14dec9328820648d1291303e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 3 Mar 2016 16:39:19 -0800 Subject: [PATCH] routers: Support special asset files. - loader.css - logo.svg - {firefox,chrome,safari}.png --- routers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routers.go b/routers.go index 278e55696..5010b031d 100644 --- a/routers.go +++ b/routers.go @@ -17,6 +17,7 @@ package main import ( + "fmt" "net" "net/http" @@ -80,6 +81,9 @@ func assetFS() *assetfs.AssetFS { } } +// specialAssets are files which are unique files not embedded inside index_bundle.js. +const specialAssets = "loader.css|logo.svg|firefox.png|safari.png|chrome.png|favicon.ico" + // registerAPIHandlers - register all the handlers to their respective paths func registerAPIHandlers(mux *router.Router, a storageAPI, w *webAPI) { // Minio rpc router @@ -94,8 +98,8 @@ func registerAPIHandlers(mux *router.Router, a storageAPI, w *webAPI) { // RPC handler at URI - /minio/rpc minio.Path("/rpc").Handler(rpc) - // Serve javascript files and favicon.ico from assets - minio.Path("/{assets:[^/]+.js|favicon.ico}").Handler(http.StripPrefix(privateBucket, http.FileServer(assetFS()))) + // Serve all assets. + minio.Path(fmt.Sprintf("/{assets:[^/]+.js|%s}", specialAssets)).Handler(http.StripPrefix(privateBucket, http.FileServer(assetFS()))) // Serve index.html for rest of the requests minio.Path("/{index:.*}").Handler(indexHandler{http.StripPrefix(privateBucket, http.FileServer(assetFS()))})