Skip to content

Commit

Permalink
Avoid panic in s3 list operation (#2785)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnayak authored and jefferai committed Jun 5, 2017
1 parent 83ecd0f commit a337f9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions physical/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ func (s *S3Backend) List(prefix string) ([]string, error) {
err := s.client.ListObjectsV2Pages(params,
func(page *s3.ListObjectsV2Output, lastPage bool) bool {
for _, key := range page.Contents {
// Avoid panic
if key == nil {
continue
}

key := strings.TrimPrefix(*key.Key, prefix)

if i := strings.Index(key, "/"); i == -1 {
Expand Down

0 comments on commit a337f9f

Please sign in to comment.