summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore/Azure.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-12-10 17:20:45 +0100
committerRobin Appelman <robin@icewind.nl>2018-12-12 15:31:44 +0100
commitfe23285e445c9f452755c306814c6db1e6819d95 (patch)
tree11d121e519fcbcfbc8d9a3bbfc1155a939a80147 /lib/private/Files/ObjectStore/Azure.php
parent474c9fb8e5d2c628a2212a611ffe456c183ad2c0 (diff)
downloadnextcloud-server-fe23285e445c9f452755c306814c6db1e6819d95.tar.gz
nextcloud-server-fe23285e445c9f452755c306814c6db1e6819d95.zip
Add objectExists to objectstore interface
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/ObjectStore/Azure.php')
-rw-r--r--lib/private/Files/ObjectStore/Azure.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/Files/ObjectStore/Azure.php b/lib/private/Files/ObjectStore/Azure.php
index 899c826ec19..e162c510b98 100644
--- a/lib/private/Files/ObjectStore/Azure.php
+++ b/lib/private/Files/ObjectStore/Azure.php
@@ -115,4 +115,17 @@ class Azure implements IObjectStore {
public function deleteObject($urn) {
$this->getBlobClient()->deleteBlob($this->containerName, $urn);
}
+
+ public function objectExists($urn) {
+ try {
+ $this->getBlobClient()->getBlobMetadata($this->containerName, $urn);
+ return true;
+ } catch (ServiceException $e) {
+ if ($e->getCode() === 404) {
+ return false;
+ } else {
+ throw $e;
+ }
+ }
+ }
}