Merge pull request #791 from fkautz/pr_out_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:52:19 -07:00
+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)