mirror of
https://github.com/versity/versitygw.git
synced 2026-10-22 06:12:39 +00:00
In a bucket with versioning `Suspended`, `CompleteMultipartUpload` only archived the object it replaced when versioning was `Enabled`, so completing an upload over a versioned object overwrote it without a snapshot and that version was lost. The null version in the versioning directory was not removed either, which left a stale `null` version next to the new one. With sidecar metadata, the leftover `versionIdKey` attribute also made the new object report the overwritten version's id. With versioning `Enabled` and sidecar metadata, the upload's metadata was stored at the object path before the replaced object was archived, so `createObjVersion` copied the new upload's content type, user metadata and other properties into the previous version. `CompleteMultipartUpload` now archives the replaced object with `snapshotObjVersion` before storing any metadata of the new object, which covers both `Enabled` and `Suspended` buckets. In a `Suspended` bucket it also removes the archived null version and clears the stale `versionIdKey` attribute, matching `PutObject` and S3 behavior.