s3: fix regression where PutObject fails with non-seekable readers
Commit a3e1312d accidentally replaced io.NopCloser(in) with a bare
io.Reader when assigning req.Body in uploadSinglepartPutObject.
rclone wraps upload readers in an accounting.Account for progress
tracking. When the AWS SDK calls Seek on the body, Account.Seek does
a type assert on the inner reader. With a bare io.Reader the type
is unexpected and causes:
operation error S3: PutObject, serialization failed: internal error:
Seek not implemented for io.nopCloser
With io.NopCloser(in) the type assert works correctly for both seekable
and non-seekable readers.
Restore io.NopCloser(in) to wrap the reader correctly in all cases.
Verified by running both before (regression confirmed) and after (fix
confirmed):
go test ./backend/s3/... ./fs/operations/... -remote TestS3:
This commit is contained in:
+1
-1
@@ -4648,7 +4648,7 @@ func (o *Object) uploadSinglepartPutObject(ctx context.Context, req *s3.PutObjec
|
||||
if err != nil {
|
||||
return etag, lastModified, nil, err
|
||||
}
|
||||
req.Body = in
|
||||
req.Body = io.NopCloser(in)
|
||||
var options = []func(*s3.Options){}
|
||||
if o.fs.opt.UseUnsignedPayload.Value {
|
||||
options = append(options, s3.WithAPIOptions(
|
||||
|
||||
Reference in New Issue
Block a user