From a337f9fcffd9464682a672a55aeda8f6411713d4 Mon Sep 17 00:00:00 2001 From: Vishal Nayak Date: Mon, 5 Jun 2017 10:53:20 -0400 Subject: [PATCH] Avoid panic in s3 list operation (#2785) --- physical/s3.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/physical/s3.go b/physical/s3.go index 8271be76d521..d39f1ae82b3f 100644 --- a/physical/s3.go +++ b/physical/s3.go @@ -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 {