do not append default port to target in bucket remote cmd(#3501)

This commit is contained in:
Poorna Krishnamoorthy
2020-11-24 17:12:37 -08:00
committed by GitHub
parent 138587816a
commit bf2f7f0292
+3 -12
View File
@@ -20,7 +20,6 @@ import (
"fmt"
"net/url"
"regexp"
"strconv"
"strings"
humanize "github.com/dustin/go-humanize"
@@ -196,15 +195,7 @@ func fetchRemoteTarget(cli *cli.Context) (sourceBucket string, bktTarget *madmin
if cerr != nil {
fatalIf(probe.NewError(cerr), "Malformed Remote target URL")
}
secure := u.Scheme == "https"
host := u.Host
if u.Port() == "" {
port := 80
if secure {
port = 443
}
host = host + ":" + strconv.Itoa(port)
}
serviceType := cli.String("service")
if !madmin.ServiceType(serviceType).IsValid() {
fatalIf(errInvalidArgument().Trace(serviceType), "Invalid service type. Valid option is `[replication]`.")
@@ -218,9 +209,9 @@ func fetchRemoteTarget(cli *cli.Context) (sourceBucket string, bktTarget *madmin
creds := &auth.Credentials{AccessKey: accessKey, SecretKey: secretKey}
bktTarget = &madmin.BucketTarget{
TargetBucket: TargetBucket,
Secure: secure,
Secure: u.Scheme == "https",
Credentials: creds,
Endpoint: host,
Endpoint: u.Host,
Path: path,
API: "s3v4",
Type: madmin.ServiceType(serviceType),