Skip to content

Commit 9d74c56

Browse files
author
Aaron Schlesinger
committed
fix(pkg/gitreceive/storage/object.go): fix error check for missing object
1 parent f84e1f8 commit 9d74c56

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/gitreceive/storage/object.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ const (
1212
octetStream = "application/octet-stream"
1313
)
1414

15-
func ObjectExists(statter ObjectStatter, bucket, objName string) (bool, error) {
15+
func ObjectExists(statter ObjectStatter, bucketName, objKey string) (bool, error) {
1616
objInfo, err := statter.StatObject(bucketName, objKey)
1717
if err != nil {
18+
minioErr := s3.ToErrorResponse(err)
19+
if minioErr.Code == noSuchKeyCode {
20+
return false, nil
21+
}
1822
return false, err
1923
}
20-
if objInfo.Code == noSuchKeyCode || objInfo.Err != nil {
24+
if objInfo.Err != nil {
2125
return false, nil
2226
}
2327
return true, nil

0 commit comments

Comments
 (0)