[web-router] update the white list for favicons (#8024)

master
Jakob Ackermann 5 years ago committed by Harshavardhana
parent 35427a017d
commit 1b258da108
  1. 4
      cmd/generic-handlers.go
  2. 18
      cmd/generic-handlers_test.go
  3. 2
      cmd/web-router.go

@ -178,7 +178,9 @@ func getRedirectLocation(urlPath string) (rLocation string) {
SlashSeparator, SlashSeparator,
"/webrpc", "/webrpc",
"/login", "/login",
"/favicon.ico", "/favicon-16x16.png",
"/favicon-32x32.png",
"/favicon-96x96.png",
}, urlPath) { }, urlPath) {
rLocation = minioReservedBucketPath + urlPath rLocation = minioReservedBucketPath + urlPath
} }

@ -53,12 +53,22 @@ func TestRedirectLocation(t *testing.T) {
location: minioReservedBucketPath + "/login", location: minioReservedBucketPath + "/login",
}, },
{ {
// 5. When urlPath is '/favicon.ico' // 5. When urlPath is '/favicon-16x16.png'
urlPath: "/favicon.ico", urlPath: "/favicon-16x16.png",
location: minioReservedBucketPath + "/favicon.ico", 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", urlPath: "/unknown",
location: "", location: "",
}, },

@ -56,7 +56,7 @@ func assetFS() *assetfs.AssetFS {
} }
// specialAssets are files which are unique files not embedded inside index_bundle.js. // 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. // registerWebRouter - registers web router for serving minio browser.
func registerWebRouter(router *mux.Router) error { func registerWebRouter(router *mux.Router) error {

Loading…
Cancel
Save