diff --git a/src/AzureBlobStorageAdapter.php b/src/AzureBlobStorageAdapter.php index 6ea3f98..0a4188d 100644 --- a/src/AzureBlobStorageAdapter.php +++ b/src/AzureBlobStorageAdapter.php @@ -28,11 +28,12 @@ use League\Flysystem\UnableToRetrieveMetadata; use League\Flysystem\UnableToSetVisibility; use League\Flysystem\UnableToWriteFile; +use League\Flysystem\UrlGeneration\PublicUrlGenerator; use League\Flysystem\UrlGeneration\TemporaryUrlGenerator; use League\MimeTypeDetection\FinfoMimeTypeDetector; use League\MimeTypeDetection\MimeTypeDetector; -final class AzureBlobStorageAdapter implements FilesystemAdapter, ChecksumProvider, TemporaryUrlGenerator +final class AzureBlobStorageAdapter implements FilesystemAdapter, ChecksumProvider, TemporaryUrlGenerator, PublicUrlGenerator { public const ON_VISIBILITY_THROW_ERROR = 'throw'; public const ON_VISIBILITY_IGNORE = 'ignore'; @@ -280,6 +281,14 @@ public function copy(string $source, string $destination, Config $config): void } } + /** + * @description Azure doesn't support permanent URLs. Instead, we create one that lasts 1000 years. + */ + public function publicUrl(string $path, Config $config): string + { + return $this->temporaryUrl($path, (new \DateTimeImmutable())->modify("+1000 years"), $config); + } + public function temporaryUrl(string $path, \DateTimeInterface $expiresAt, Config $config): string { $permissions = $config->get("permissions", "r");