Skip to content

Commit

Permalink
Merge pull request #62 from keboola/azure-check-if-container-exists
Browse files Browse the repository at this point in the history
Azure - check if container exists
  • Loading branch information
ondrajodas authored Feb 8, 2025
2 parents ee4c64c + 302b068 commit 391ded0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Storages/AzureBlobStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 391ded0

Please sign in to comment.