Skip to content

Commit

Permalink
Change url generating logic (#15291)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwex authored and taylorotwell committed Sep 6, 2016
1 parent cf7939c commit 4bede79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Filesystem/FilesystemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,16 @@ public function url($path)
{
$adapter = $this->driver->getAdapter();

if ($adapter instanceof AwsS3Adapter) {
if (method_exists($adapter, 'getUrl')) {
return $adapter->getUrl($path);
} elseif ($adapter instanceof AwsS3Adapter) {
$path = $adapter->getPathPrefix().$path;

return $adapter->getClient()->getObjectUrl($adapter->getBucket(), $path);
} elseif ($adapter instanceof LocalAdapter) {
$path = '/storage/'.$path;

return Str::contains($path, '/storage/public') ? Str::replaceFirst('/public', '', $path) : $path;
} elseif (method_exists($adapter, 'getUrl')) {
return $adapter->getUrl($path);
} else {
throw new RuntimeException('This driver does not support retrieving URLs.');
}
Expand Down

0 comments on commit 4bede79

Please sign in to comment.