From 21c677fc2d1126e418af289225c009f51bd08d06 Mon Sep 17 00:00:00 2001 From: CarterMcClellan Date: Tue, 13 Jun 2017 14:50:17 -0700 Subject: [PATCH] config: default S3v2 for google endpoints (#2179) --- cmd/config-host-add.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/config-host-add.go b/cmd/config-host-add.go index b1b4638e..98f4290a 100644 --- a/cmd/config-host-add.go +++ b/cmd/config-host-add.go @@ -17,6 +17,8 @@ package cmd import ( + urlpkg "net/url" + "github.com/fatih/color" "github.com/minio/cli" "github.com/minio/mc/pkg/console" @@ -126,6 +128,16 @@ func mainConfigHostAdd(ctx *cli.Context) error { accessKey := args.Get(2) secretKey := args.Get(3) api := args.Get(4) + + parsedURL, _ := urlpkg.Parse(url) + + if isGoogle(parsedURL.Host) { + if api == "S3v4" { + fatalIf(errInvalidArgument().Trace(api), "Unsupported API signature for url. Please use `mc config host add "+alias+" "+url+" "+accessKey+" "+secretKey+" S3v2` instead.") + } + api = "S3v2" + } + if api == "" { api = "S3v4" }