Strip standard ports off remote target url (#10498)

This commit is contained in:
poornas 2020-09-17 11:09:50 -07:00 committed by GitHub
parent 03490c811b
commit 00555c747e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,7 +118,15 @@ func (t BucketTarget) URL() string {
if t.Secure {
scheme = "https"
}
return fmt.Sprintf("%s://%s", scheme, t.Endpoint)
urlStr := fmt.Sprintf("%s://%s", scheme, t.Endpoint)
u, err := url.Parse(urlStr)
if err != nil {
return urlStr
}
if u.Port() == "80" || u.Port() == "443" {
u.Host = u.Hostname()
}
return u.String()
}
// Empty returns true if struct is empty.