mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
s3: ignore versionIDs from uploads unless using --s3-versions or --s3-versions-at
Before this change, when a new object was created s3 returns its versionID (on a versioned bucket) and rclone recorded it in the object. This means that when rclone came to delete the object it would delete it with the versionID. However it is common to forbid actions with versionIDs on buckets so as to preserve the historical record and these operations would fail whereas they succeeded in pre-v1.60.0 versions. This patch fixes the problem by not recording versions of objects supplied by the S3 API on upload unless `--s3-versions` or `--s3-version-at` is used. This makes rclone behave as it did before v1.60.0 when version support was introduced. See: https://forum.rclone.org/t/s3-and-intermittent-403-errors-with-file-renames-and-drag-and-drop-operations-in-windows-explorer/34773
This commit is contained in:
parent
614d79121a
commit
01877e5a0f
|
@ -5507,7 +5507,12 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.versionID = versionID
|
||||
// Only record versionID if we are using --s3-versions or --s3-version-at
|
||||
if o.fs.opt.Versions || o.fs.opt.VersionAt.IsSet() {
|
||||
o.versionID = versionID
|
||||
} else {
|
||||
o.versionID = nil
|
||||
}
|
||||
|
||||
// User requested we don't HEAD the object after uploading it
|
||||
// so make up the object as best we can assuming it got
|
||||
|
|
Loading…
Reference in New Issue
Block a user