Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

putio: fix multithread download and other ranged requests

rafma0be9ee1d13875
diff --git a/backend/putio/error.go b/backend/putio/error.go
index 27476b838..ff3fed1d5 100644
--- a/backend/putio/error.go
+++ b/backend/putio/error.go
@@ -12,11 +12,13 @@ import (
"github.com/rclone/rclone/lib/pacer"
)
-func checkStatusCode(resp *http.Response, expected int) error {
- if resp.StatusCode != expected {
- return &statusCodeError{response: resp}
+func checkStatusCode(resp *http.Response, expected ...int) error {
+ for _, code := range expected {
+ if resp.StatusCode == code {
+ return nil
+ }
}
- return nil
+ return &statusCodeError{response: resp}
}
type statusCodeError struct {
diff --git a/backend/putio/object.go b/backend/putio/object.go
index 4b5f72015..28caa5d1e 100644
--- a/backend/putio/object.go
+++ b/backend/putio/object.go
@@ -244,7 +244,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
if err != nil {
return shouldRetry(ctx, err)
}
- if err := checkStatusCode(resp, 200); err != nil {
+ if err := checkStatusCode(resp, 200, 206); err != nil {
return shouldRetry(ctx, err)
}
return false, nil