fix(ObjectStore/S3): switch to more reliable doesObjectExistV2

The non-v2 version is deprecated, but more importantly the V2 implementation makes fewer assumptions about ambiguous or unexpected status codes. For example, a 403 would result in a false (object does not exist) in V1, but that's not necessarily what that means. V2 returns true/false on a much more narrow set of scenarios. And it throws for all others so they can be diagnosed properly.

Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
Josh 2026-03-10 11:12:57 -04:00 committed by GitHub
parent 3e78bf662d
commit 7bcf684f81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -266,8 +266,11 @@ trait S3ObjectTrait {
]);
}
/**
* @throws S3Exception|\Exception if there is an unhandled exception
*/
public function objectExists($urn) {
return $this->getConnection()->doesObjectExist($this->bucket, $urn, $this->getSSECParameters());
return $this->getConnection()->doesObjectExistV2($this->bucket, $urn, false, $this->getSSECParameters());
}
public function copyObject($from, $to, array $options = []) {