Skip to content

Commit

Permalink
fix: Do not clean empty keyPrefix (#39)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Behar <[email protected]>
  • Loading branch information
simster7 committed Mar 11, 2021
1 parent a4e9672 commit 257ed55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ func (s *s3client) IsDirectory(bucket, key string) (bool, error) {

func (s *s3client) ListDirectory(bucket, keyPrefix string) ([]string, error) {
log.Infof("Listing directory from s3 (endpoint: %s, bucket: %s, key: %s)", s.Endpoint, bucket, keyPrefix)
keyPrefix = filepath.Clean(keyPrefix) + "/"
if os.PathSeparator == '\\' {
keyPrefix = strings.ReplaceAll(keyPrefix, "\\", "/")

if keyPrefix != "" {
keyPrefix = filepath.Clean(keyPrefix) + "/"
if os.PathSeparator == '\\' {
keyPrefix = strings.ReplaceAll(keyPrefix, "\\", "/")
}
}

doneCh := make(chan struct{})
Expand Down

0 comments on commit 257ed55

Please sign in to comment.