Files
floci/src
TiM b437e1cc32 fix(s3): honour CopyObject destination and copy-source preconditions (#4984)
* fix(s3): honour CopyObject destination and copy-source preconditions

CopyObject ignored every precondition. If-None-Match: * over an existing
destination, and If-Match with a stale destination ETag, both answered 200 and
overwrote it; If-Match against a missing destination created it; and the four
x-amz-copy-source-if-* headers were never read, on CopyObject or UploadPartCopy.

Destination If-Match / If-None-Match now travel into the write the copy already
performs, so they are checked by the same code and under the same bucket
monitor as a conditional PutObject: 412 on a failed condition, 404 NoSuchKey
for If-Match on a missing key. Other If-None-Match values keep the literal-ETag
meaning they have on PutObject.

The copy-source conditions are checked against the resolved source object
with the pairing rules S3 documents for CopyObject: a matching if-match makes
if-unmodified-since irrelevant, and a matching if-none-match fails whatever
if-modified-since says. Every failure is 412, never 304. Dates compare at
second precision, the resolution of an HTTP date and of Last-Modified.

* test(s3): pin CopyObject's condition names and pairing controls

Destination failures now assert the <Condition> they report, and each
pairing test first shows its date condition's result alone, so the pair's
outcome can only come from the precedence rule.

* test(s3): assert a rejected UploadPartCopy leaves the existing part intact
2026-10-02 23:07:44 -04:00
..