Skip to content

Commit

Permalink
fixed: fixed Laravel temporary URL issue overtrue/laravel-filesystem-…
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Sep 18, 2024
1 parent 62bbfc1 commit 59de3a7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/CosAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use League\Flysystem\Visibility;
use Overtrue\CosClient\BucketClient;
use Overtrue\CosClient\Exceptions\ClientException;
use Overtrue\CosClient\Exceptions\InvalidConfigException;
use Overtrue\CosClient\ObjectClient;
use TheNorthMemory\Xml\Transformer;

Expand Down Expand Up @@ -341,6 +340,19 @@ public function getUrl(string $path): string
return $this->config['signed_url'] ? $this->getSignedUrl($path) : $this->getObjectClient()->getObjectUrl($prefixedPath);
}

public function getTemporaryUrl(string $path, $expiration)
{
if ($expiresAt instanceof \DateTimeInterface) {
$expiration = $expiresAt->getTimestamp();
}

try {
return $this->getSignedUrl($path, $expiration);
} catch (\Throwable $exception) {
throw UnableToGenerateTemporaryUrl::dueToError($path, $exception);
}
}

public function temporaryUrl(string $path, DateTimeInterface $expiresAt, Config $config): string
{
if ($expiresAt instanceof \DateTimeInterface) {
Expand Down

0 comments on commit 59de3a7

Please sign in to comment.