Skip to content

Commit de33fef

Browse files
Merge pull request #20 from biigle/patch-1
Add conditional providesTemporaryUrls() method
2 parents 6513a97 + 6ee2a83 commit de33fef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/AzureStorageBlobAdapter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@
1515
*/
1616
final class AzureStorageBlobAdapter extends FilesystemAdapter
1717
{
18+
/**
19+
* Whether the configuration of this adapter allows temporary URLs.
20+
*/
21+
public bool $canProvideTemporaryUrls;
22+
1823
/**
1924
* @param array{connection_string: string, container: string, prefix?: string, root?: string} $config
2025
*/
2126
public function __construct(array $config)
2227
{
2328
$serviceClient = BlobServiceClient::fromConnectionString($config['connection_string']);
2429
$containerClient = $serviceClient->getContainerClient($config['container']);
30+
$this->canProvideTemporaryUrls = $containerClient->canGenerateSasUri();
2531
$adapter = new AzureBlobStorageAdapter($containerClient, $config['prefix'] ?? $config['root'] ?? '');
2632

2733
parent::__construct(
@@ -43,7 +49,7 @@ public function url($path)
4349
*/
4450
public function providesTemporaryUrls()
4551
{
46-
return true;
52+
return $this->canProvideTemporaryUrls;
4753
}
4854

4955
/**

0 commit comments

Comments
 (0)