From 434edba275b4032a197808568781dbcbcfc38bf8 Mon Sep 17 00:00:00 2001 From: Chris <238498929+chris081519-crypto@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:24:28 +0100 Subject: [PATCH] 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: --- backend/s3/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 5603ad6a1..ee40cfeec 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -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(