Skip to content

Commit

Permalink
Merge pull request #78 from horacimacias/feature/missingslash
Browse files Browse the repository at this point in the history
Now init message has double slash
  • Loading branch information
hypnoglow authored Nov 2, 2019
2 parents e6d13b3 + 937e316 commit 0bd6100
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Fixed incorrect s3 url when "proxy" runs on uninitialized repository.
[Refs: [#77](https://github.com/hypnoglow/helm-s3/issues/77) [#78](https://github.com/hypnoglow/helm-s3/pull/78)] [@horacimacias](https://github.com/horacimacias)

## [0.8.0]

### Added
Expand Down
12 changes: 9 additions & 3 deletions cmd/helms3/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"path"
"strings"

"github.com/pkg/errors"
Expand All @@ -16,6 +15,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 {
Expand All @@ -25,8 +26,13 @@ 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,
strings.TrimSuffix(strings.TrimSuffix(act.uri, indexYaml), "/"),
)
}
return errors.WithMessage(err, "fetch from s3")
}
Expand Down

0 comments on commit 0bd6100

Please sign in to comment.