diff --git a/cmd/client-s3.go b/cmd/client-s3.go index 0249c42b..fcaefed4 100644 --- a/cmd/client-s3.go +++ b/cmd/client-s3.go @@ -812,7 +812,6 @@ func (c *s3Client) Stat(isIncomplete bool) (*clientContent, *probe.Error) { return objectMetadata, nil } } - return nil, probe.NewError(ObjectMissing{}) } @@ -835,8 +834,32 @@ func (c *s3Client) Stat(isIncomplete bool) (*clientContent, *probe.Error) { return objectMetadata, nil } } - - return nil, probe.NewError(ObjectMissing{}) + objectStat, e := c.api.StatObject(bucket, object) + if e != nil { + errResponse := minio.ToErrorResponse(e) + if errResponse.Code == "AccessDenied" { + return nil, probe.NewError(PathInsufficientPermission{Path: c.targetURL.String()}) + } + if errResponse.Code == "NoSuchBucket" { + return nil, probe.NewError(BucketDoesNotExist{ + Bucket: bucket, + }) + } + if errResponse.Code == "InvalidBucketName" { + return nil, probe.NewError(BucketInvalid{ + Bucket: bucket, + }) + } + if errResponse.Code == "NoSuchKey" || errResponse.Code == "InvalidArgument" { + return nil, probe.NewError(ObjectMissing{}) + } + return nil, probe.NewError(e) + } + objectMetadata.URL = *c.targetURL + objectMetadata.Time = objectStat.LastModified + objectMetadata.Size = objectStat.Size + objectMetadata.Type = os.FileMode(0664) + return objectMetadata, nil } func isAmazon(host string) bool { diff --git a/cmd/difference.go b/cmd/difference.go index b539c18a..05135bd1 100644 --- a/cmd/difference.go +++ b/cmd/difference.go @@ -82,21 +82,13 @@ func objectDifference(sourceClnt, targetClnt Client, sourceURL, targetURL string } if !srcEOF && srcCtnt.Err != nil { - if isErrIgnored(srcCtnt.Err) { - errorIf(srcCtnt.Err.Trace(sourceURL, targetURL), fmt.Sprintf("Failed on '%s'", sourceURL)) - } else { - errorIf(srcCtnt.Err.Trace(sourceURL, targetURL), fmt.Sprintf("Failed on '%s'", sourceURL)) - } + errorIf(srcCtnt.Err.Trace(sourceURL, targetURL), fmt.Sprintf("Failed on '%s'", sourceURL)) srcCtnt, srcOk = <-srcCh continue } if !tgtEOF && tgtCtnt.Err != nil { - if isErrIgnored(tgtCtnt.Err) { - errorIf(tgtCtnt.Err.Trace(sourceURL, targetURL), fmt.Sprintf("Failed on '%s'", targetURL)) - } else { - errorIf(tgtCtnt.Err.Trace(sourceURL, targetURL), fmt.Sprintf("Failed on '%s'", targetURL)) - } + errorIf(tgtCtnt.Err.Trace(sourceURL, targetURL), fmt.Sprintf("Failed on '%s'", targetURL)) tgtCtnt, tgtOk = <-tgtCh continue }