Testing to see if the error is an errorresponse. If it isn't, just pass as is.

This commit is contained in:
Frederick F. Kautz IV
2015-06-12 21:50:30 -07:00
parent b308a5025f
commit ed7b8a092c
+10 -8
View File
@@ -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)