Fix double slash subpath for console (#14815)

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia 2022-04-25 13:05:56 -07:00 committed by GitHub
parent d2a95a04a4
commit b7dd61f6bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"sort" "sort"
@ -179,7 +180,10 @@ func minioConfigToConsoleFeatures() {
} }
// pass the console subpath configuration // pass the console subpath configuration
if value := env.Get(config.EnvMinIOBrowserRedirectURL, ""); value != "" { if value := env.Get(config.EnvMinIOBrowserRedirectURL, ""); value != "" {
os.Setenv("CONSOLE_SUBPATH", pathJoin(globalBrowserRedirectURL.Path, SlashSeparator)) subPath := path.Clean(pathJoin(strings.TrimSpace(globalBrowserRedirectURL.Path), SlashSeparator))
if subPath != SlashSeparator {
os.Setenv("CONSOLE_SUBPATH", subPath)
}
} }
// Enable if prometheus URL is set. // Enable if prometheus URL is set.
if value := env.Get("MINIO_PROMETHEUS_URL", ""); value != "" { if value := env.Get("MINIO_PROMETHEUS_URL", ""); value != "" {