Skip to content

Commit

Permalink
Fix proper response for BucketExists API (#1038)
Browse files Browse the repository at this point in the history
when resp 404 Not Found, BucketExists error should be nil, exists==false

Fixes #1036
  • Loading branch information
panfengAtInspur authored and harshavardhana committed Oct 15, 2018
1 parent 77fe7e4 commit 31e3bbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api-stat.go
Expand Up @@ -47,6 +47,10 @@ func (c Client) BucketExists(bucketName string) (bool, error) {
return false, err
}
if resp != nil {
resperr := httpRespToErrorResponse(resp, bucketName, "")
if ToErrorResponse(resperr).Code == "NoSuchBucket" {
return false, nil
}
if resp.StatusCode != http.StatusOK {
return false, httpRespToErrorResponse(resp, bucketName, "")
}
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -16,7 +16,7 @@ install:
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
- go version
- go env
- go get -u github.com/golang/lint/golint
- go get -u golang.org/x/lint/golint
- go get -u github.com/remyoudompheng/go-misc/deadcode
- go get -u github.com/gordonklaus/ineffassign
- go get -u golang.org/x/crypto/argon2
Expand Down

0 comments on commit 31e3bbc

Please sign in to comment.