From 302b0683d474e4a9a2cfbf58a4f640192d1c937b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jodas?= Date: Fri, 7 Feb 2025 23:34:00 +0100 Subject: [PATCH] Azure - check if container exists --- src/Storages/AzureBlobStorage.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Storages/AzureBlobStorage.php b/src/Storages/AzureBlobStorage.php index 8a2e111..48c1e61 100644 --- a/src/Storages/AzureBlobStorage.php +++ b/src/Storages/AzureBlobStorage.php @@ -41,7 +41,14 @@ public function generateTempReadCredentials(string $backupId, string $path): arr $this->config->getAccountKey(), ); $client = ClientFactory::createClientFromConnectionString($connectionString); - $client->createContainer($path); + try { + $client->getContainerMetadata($path); + } catch (ServiceException $e) { + if ($e->getCode() !== 404) { + throw $e; + } + $client->createContainer($path); + } $sasHelper = new BlobSharedAccessSignatureHelper( $this->config->getAccountName(),