Skip to content

Commit b11aeb8

Browse files
author
brecht.vermeersch
committed
add public url generation
1 parent 71e9909 commit b11aeb8

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"autoload-dev": {
1212
"psr-4": {
13-
"AzureOss\\LaravelAzureStorageBlob\\Tests": "tests/"
13+
"AzureOss\\LaravelAzureStorageBlob\\Tests\\": "tests/"
1414
}
1515
},
1616
"authors": [
@@ -23,7 +23,7 @@
2323
"php": "^8.1",
2424
"illuminate/filesystem": "^10|^11",
2525
"illuminate/support": "^10|^11",
26-
"azure-oss/storage-blob-flysystem": "^1.1"
26+
"azure-oss/storage-blob-flysystem": "^1.2"
2727
},
2828
"require-dev": {
2929
"laravel/pint": "^1.17",

src/AzureStorageBlobAdapter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public function __construct(array $config)
3131
);
3232
}
3333

34+
public function url($path)
35+
{
36+
return $this->adapter->publicUrl($path, new Config);
37+
}
38+
3439
/** @phpstan-ignore-next-line */
3540
public function temporaryUrl($path, $expiration, array $options = [])
3641
{

src/AzureStorageBlobServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function boot(): void
2626
if (isset($config['prefix']) && ! is_string($config['prefix'])) {
2727
throw new \InvalidArgumentException('The [prefix] must be a string in the disk configuration.');
2828
}
29-
29+
3030
if (isset($config['root']) && ! is_string($config['root'])) {
3131
throw new \InvalidArgumentException('The [root] must be a string in the disk configuration.');
3232
}

tests/AzureStorageBlobAdapterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public function driver_works(): void
5353
'content',
5454
Http::get($driver->temporaryUrl('file.txt', now()->addMinute()))->body()
5555
);
56+
self::assertEquals(
57+
'content',
58+
Http::get($driver->url('file.txt'))->body()
59+
);
5660

5761
$driver->copy('file.txt', 'file2.txt');
5862

0 commit comments

Comments
 (0)