Skip to content

Commit

Permalink
[5.2] check for getUrl method on the adapter before throwing exceptio…
Browse files Browse the repository at this point in the history
…n - Filesystem (#14246)

* check for getUrl method on the adapter

It is better to check if the $adapter supports a getUrl function instead of telling that this driver does not support retrieving URLs.

* fix the typo

* styling fix
  • Loading branch information
hocza authored and taylorotwell committed Jul 8, 2016
1 parent 3b005e5 commit d567b2b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions FilesystemAdapter.php
Expand Up @@ -238,6 +238,8 @@ public function url($path)
return $adapter->getClient()->getObjectUrl($adapter->getBucket(), $path);
} elseif ($adapter instanceof LocalAdapter) {
return '/storage/'.$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 d567b2b

Please sign in to comment.