Skip to content

Commit 5dd58d4

Browse files
committed
Merge remote-tracking branch 'upstream/9.x' into 9.x
2 parents 79325d1 + 7cb6dbf commit 5dd58d4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Illuminate/Filesystem/FilesystemAdapter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,10 @@ public function writeStream($path, $resource, array $options = [])
620620
*/
621621
public function url($path)
622622
{
623+
if (isset($this->config['prefix'])) {
624+
$path = $this->concatPathToUrl($this->config['prefix'], $path);
625+
}
626+
623627
$adapter = $this->adapter;
624628

625629
if (method_exists($adapter, 'getUrl')) {

tests/Filesystem/FilesystemAdapterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,4 +564,11 @@ public function testProvidesTemporaryUrlsForAdapterWithoutTemporaryUrlSupport()
564564

565565
$this->assertFalse($filesystemAdapter->providesTemporaryUrls());
566566
}
567+
568+
public function testPrefixesUrls()
569+
{
570+
$filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter, ['url' => 'https://example.org/', 'prefix' => 'images']);
571+
572+
$this->assertEquals('https://example.org/images/picture.jpeg', $filesystemAdapter->url('picture.jpeg'));
573+
}
567574
}

0 commit comments

Comments
 (0)