From 7bcf684f813f99356a7951732487f3c8fee2c4d9 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 10 Mar 2026 11:12:57 -0400 Subject: [PATCH 1/2] 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 --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 384e9f0ff58c9..3b8a71bfd86a1 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -266,8 +266,11 @@ public function deleteObject($urn) { ]); } + /** + * @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 = []) { From 30bbb13f9a387c978e7c72941c1dda4f4c781b1c Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 10 Mar 2026 11:51:47 -0400 Subject: [PATCH 2/2] chore: at S3Exception to S3ObjectTrait Signed-off-by: Josh --- lib/private/Files/ObjectStore/S3ObjectTrait.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 3b8a71bfd86a1..ec06b5920d757 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -9,6 +9,7 @@ use Aws\Command; use Aws\Exception\AwsException; use Aws\Exception\MultipartUploadException; +use Aws\S3\Exception\S3Exception; use Aws\S3\Exception\S3MultipartUploadException; use Aws\S3\MultipartCopy; use Aws\S3\MultipartUploader;