From 1b258da10803d89b26746a3323172c0308e199a7 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Mon, 12 Aug 2019 07:17:02 +0200 Subject: [PATCH] [web-router] update the white list for favicons (#8024) --- cmd/generic-handlers.go | 4 +++- cmd/generic-handlers_test.go | 18 ++++++++++++++---- cmd/web-router.go | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cmd/generic-handlers.go b/cmd/generic-handlers.go index f8766ed4c..c66f2fee7 100644 --- a/cmd/generic-handlers.go +++ b/cmd/generic-handlers.go @@ -178,7 +178,9 @@ func getRedirectLocation(urlPath string) (rLocation string) { SlashSeparator, "/webrpc", "/login", - "/favicon.ico", + "/favicon-16x16.png", + "/favicon-32x32.png", + "/favicon-96x96.png", }, urlPath) { rLocation = minioReservedBucketPath + urlPath } diff --git a/cmd/generic-handlers_test.go b/cmd/generic-handlers_test.go index a7f98d78f..d31845f13 100644 --- a/cmd/generic-handlers_test.go +++ b/cmd/generic-handlers_test.go @@ -53,12 +53,22 @@ func TestRedirectLocation(t *testing.T) { location: minioReservedBucketPath + "/login", }, { - // 5. When urlPath is '/favicon.ico' - urlPath: "/favicon.ico", - location: minioReservedBucketPath + "/favicon.ico", + // 5. When urlPath is '/favicon-16x16.png' + urlPath: "/favicon-16x16.png", + location: minioReservedBucketPath + "/favicon-16x16.png", }, { - // 6. When urlPath is '/unknown' + // 6. When urlPath is '/favicon-16x16.png' + urlPath: "/favicon-32x32.png", + location: minioReservedBucketPath + "/favicon-32x32.png", + }, + { + // 7. When urlPath is '/favicon-96x96.png' + urlPath: "/favicon-96x96.png", + location: minioReservedBucketPath + "/favicon-96x96.png", + }, + { + // 8. When urlPath is '/unknown' urlPath: "/unknown", location: "", }, diff --git a/cmd/web-router.go b/cmd/web-router.go index dcf8576f8..f717c8823 100644 --- a/cmd/web-router.go +++ b/cmd/web-router.go @@ -56,7 +56,7 @@ func assetFS() *assetfs.AssetFS { } // specialAssets are files which are unique files not embedded inside index_bundle.js. -const specialAssets = "index_bundle.*.js|loader.css|logo.svg|firefox.png|safari.png|chrome.png|favicon.ico" +const specialAssets = "index_bundle.*.js|loader.css|logo.svg|firefox.png|safari.png|chrome.png|favicon-16x16.png|favicon-32x32.png|favicon-96x96.png" // registerWebRouter - registers web router for serving minio browser. func registerWebRouter(router *mux.Router) error {