diff --git a/cmd/s3-authmate/main.go b/cmd/s3-authmate/main.go index 478b095e..f79f69ce 100644 --- a/cmd/s3-authmate/main.go +++ b/cmd/s3-authmate/main.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "net/http" + "net/url" "os" "os/signal" "runtime" @@ -477,6 +478,15 @@ It will be ceil rounded to the nearest amount of epoch.`, }) } + u, err := url.Parse(endpointFlag) + if err != nil { + return fmt.Errorf("invalid endpoint %q: %w", endpointFlag, err) + } + + if u.Scheme != "http" && u.Scheme != "https" { + return fmt.Errorf("invalid endpoint %[1]q, you must specify scheme. For instance: http://%[1]s or https://%[1]s", endpointFlag, err) + } + sess, err := session.NewSessionWithOptions(session.Options{ Config: cfg, Profile: profileFlag,