From c9bd6f34cf855763df4a00cd3a658fb5cc5392fb Mon Sep 17 00:00:00 2001 From: Horaci Macias Date: Wed, 17 Jul 2019 09:44:31 +0200 Subject: [PATCH] Now init message has double slash --- cmd/helms3/proxy.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/helms3/proxy.go b/cmd/helms3/proxy.go index 9777eeca..55612cda 100644 --- a/cmd/helms3/proxy.go +++ b/cmd/helms3/proxy.go @@ -16,6 +16,8 @@ type proxyCmd struct { uri string } +const indexYaml = "index.yaml" + func (act proxyCmd) Run(ctx context.Context) error { sess, err := awsutil.Session(awsutil.AssumeRoleTokenProvider(awsutil.StderrTokenProvider)) if err != nil { @@ -25,8 +27,8 @@ func (act proxyCmd) Run(ctx context.Context) error { b, err := storage.FetchRaw(ctx, act.uri) if err != nil { - if strings.HasSuffix(act.uri, "index.yaml") && err == awss3.ErrObjectNotFound { - return fmt.Errorf("The index file does not exist by the path %s. If you haven't initialized the repository yet, try running \"helm s3 init %s\"", act.uri, path.Dir(act.uri)) + if strings.HasSuffix(act.uri, indexYaml) && err == awss3.ErrObjectNotFound { + return fmt.Errorf("The index file does not exist by the path %s. If you haven't initialized the repository yet, try running \"helm s3 init %s\"", act.uri, act.uri[0:len(indexYaml)]) } return errors.WithMessage(err, "fetch from s3") }