diff options
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/api-error-response.go')
| -rw-r--r-- | vendor/github.com/minio/minio-go/v7/api-error-response.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/api-error-response.go b/vendor/github.com/minio/minio-go/v7/api-error-response.go index e85aa322c..e5f88d98e 100644 --- a/vendor/github.com/minio/minio-go/v7/api-error-response.go +++ b/vendor/github.com/minio/minio-go/v7/api-error-response.go @@ -20,6 +20,7 @@ package minio import ( "bytes" "encoding/xml" + "errors" "fmt" "io" "net/http" @@ -128,9 +129,18 @@ func httpRespToErrorResponse(resp *http.Response, bucketName, objectName string) Server: resp.Header.Get("Server"), } + _, success := successStatus[resp.StatusCode] + errBody, err := xmlDecodeAndBody(resp.Body, &errResp) // Xml decoding failed with no body, fall back to HTTP headers. if err != nil { + var unmarshalErr xml.UnmarshalError + if success && errors.As(err, &unmarshalErr) { + // This is a successful message so not an error response + // return nil, + return nil + } + switch resp.StatusCode { case http.StatusNotFound: if objectName == "" { |
