fix: obtain correct location string with DNS style buckets (#10060)

closes #10054
This commit is contained in:
Harshavardhana
2020-07-16 13:28:29 -07:00
committed by GitHub
parent 1341bf5a9e
commit 7342b5355f
2 changed files with 11 additions and 9 deletions

View File

@@ -396,8 +396,7 @@ func getObjectLocation(r *http.Request, domains []string, bucket, object string)
}
// If domain is set then we need to use bucket DNS style.
for _, domain := range domains {
if strings.Contains(r.Host, domain) {
u.Host = bucket + "." + r.Host
if strings.HasPrefix(r.Host, bucket+"."+domain) {
u.Path = path.Join(SlashSeparator, object)
break
}