File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 21
21
use League \Flysystem \Visibility ;
22
22
use Overtrue \CosClient \BucketClient ;
23
23
use Overtrue \CosClient \Exceptions \ClientException ;
24
- use Overtrue \CosClient \Exceptions \InvalidConfigException ;
25
24
use Overtrue \CosClient \ObjectClient ;
26
25
use TheNorthMemory \Xml \Transformer ;
27
26
@@ -341,6 +340,19 @@ public function getUrl(string $path): string
341
340
return $ this ->config ['signed_url ' ] ? $ this ->getSignedUrl ($ path ) : $ this ->getObjectClient ()->getObjectUrl ($ prefixedPath );
342
341
}
343
342
343
+ public function getTemporaryUrl (string $ path , $ expiration )
344
+ {
345
+ if ($ expiresAt instanceof \DateTimeInterface) {
346
+ $ expiration = $ expiresAt ->getTimestamp ();
347
+ }
348
+
349
+ try {
350
+ return $ this ->getSignedUrl ($ path , $ expiration );
351
+ } catch (\Throwable $ exception ) {
352
+ throw UnableToGenerateTemporaryUrl::dueToError ($ path , $ exception );
353
+ }
354
+ }
355
+
344
356
public function temporaryUrl (string $ path , DateTimeInterface $ expiresAt , Config $ config ): string
345
357
{
346
358
if ($ expiresAt instanceof \DateTimeInterface) {
You can’t perform that action at this time.
0 commit comments