mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 14:56:29 +00:00
api: Failed call retry with region only when http.StatusBadRequest.
Fixes https://github.com/minio/minio-go/issues/677
This commit is contained in:
parent
0249c16b04
commit
c7209ef231
@ -89,7 +89,7 @@ func (c Client) MakeBucket(bucketName string, location string) (err error) {
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
err := httpRespToErrorResponse(resp, bucketName, "")
|
||||
errResp := ToErrorResponse(err)
|
||||
if errResp.Code == "InvalidRegion" && errResp.Region != "" {
|
||||
if resp.StatusCode == http.StatusBadRequest && errResp.Region != "" {
|
||||
// Fetch bucket region found in headers
|
||||
// of S3 error response, attempt bucket
|
||||
// create again.
|
||||
|
@ -157,11 +157,13 @@ func hashCopyN(hashAlgorithms map[string]hash.Hash, hashSums map[string][]byte,
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range hashAlgorithms {
|
||||
hashSums[k] = v.Sum(nil)
|
||||
if err == nil && size == partSize {
|
||||
for k, v := range hashAlgorithms {
|
||||
hashSums[k] = v.Sum(nil)
|
||||
}
|
||||
return size, nil
|
||||
}
|
||||
return size, err
|
||||
return 0, ErrUnexpectedEOF(size, partSize, "", "")
|
||||
}
|
||||
|
||||
// getUploadID - fetch upload id if already present for an object name
|
||||
|
2
vendor/src/github.com/minio/minio-go/api.go
vendored
2
vendor/src/github.com/minio/minio-go/api.go
vendored
@ -553,7 +553,7 @@ func (c Client) executeMethod(method string, metadata requestMetadata) (res *htt
|
||||
// Bucket region if set in error response and the error
|
||||
// code dictates invalid region, we can retry the request
|
||||
// with the new region.
|
||||
if errResponse.Code == "InvalidRegion" && errResponse.Region != "" {
|
||||
if res.StatusCode == http.StatusBadRequest && errResponse.Region != "" {
|
||||
c.bucketLocCache.Set(metadata.bucketName, errResponse.Region)
|
||||
continue // Retry.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user