mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 10:06:37 -04:00
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:
parent
3e78bf662d
commit
7bcf684f81
1 changed files with 4 additions and 1 deletions
|
|
@ -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 = []) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue