Skip to content

Commit

Permalink
Merge pull request #15 from tekkamanendless/fix-prefix-problem-in-lis…
Browse files Browse the repository at this point in the history
…ting

Fix another prefix-related problem
  • Loading branch information
pottava authored May 23, 2018
2 parents 3eb27d0 + b050dce commit efea189
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ func s3listFiles(w http.ResponseWriter, r *http.Request, backet, key string) {
candidates := map[string]bool{}
updatedAt := map[string]time.Time{}
for _, obj := range result.Contents {
candidate := strings.Replace(aws.StringValue(obj.Key), key, "", -1)
candidate := strings.TrimPrefix(aws.StringValue(obj.Key), key)
if len(candidate) == 0 {
continue
}
candidates[candidate] = true
updatedAt[candidate] = *obj.LastModified
}
for _, obj := range result.CommonPrefixes {
candidate := strings.Replace(aws.StringValue(obj.Prefix), key, "", -1)
candidate := strings.TrimPrefix(aws.StringValue(obj.Prefix), key)
if len(candidate) == 0 {
continue
}
Expand Down

0 comments on commit efea189

Please sign in to comment.