From ed7b8a092ca8a83f014babfbd40d06175f46cefb Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Fri, 12 Jun 2015 21:50:30 -0700 Subject: [PATCH] Testing to see if the error is an errorresponse. If it isn't, just pass as is. --- pkg/client/s3/s3.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/client/s3/s3.go b/pkg/client/s3/s3.go index 7afdfc25..d76d5c87 100644 --- a/pkg/client/s3/s3.go +++ b/pkg/client/s3/s3.go @@ -155,15 +155,17 @@ func (c *s3Client) Stat() (*client.Content, error) { metadata, err := c.api.StatObject(bucket, object) if err != nil { errResponse := s3.ToErrorResponse(err) - if errResponse.Code == "NoSuchKey" { - for content := range c.List(false) { - if content.Err != nil { - return nil, iodine.New(err, nil) + if errResponse != nil { + if errResponse.Code == "NoSuchKey" { + for content := range c.List(false) { + if content.Err != nil { + return nil, iodine.New(err, nil) + } + content.Content.Type = os.ModeDir + content.Content.Name = object + content.Content.Size = 0 + return content.Content, nil } - content.Content.Type = os.ModeDir - content.Content.Name = object - content.Content.Size = 0 - return content.Content, nil } } return nil, iodine.New(err, nil)