Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/AzureBlobStorageAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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");
Expand Down