Skip to content

Commit

Permalink
Merge branch 'ftp_storage_url' of https://github.com/shadoWalker89/fr…
Browse files Browse the repository at this point in the history
…amework into shadoWalker89-ftp_storage_url
  • Loading branch information
taylorotwell committed Jan 28, 2020
2 parents e113e14 + 06abd3a commit 4deaad3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Illuminate/Filesystem/FilesystemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use InvalidArgumentException;
use League\Flysystem\Adapter\Ftp;
use League\Flysystem\Adapter\Local as LocalAdapter;
use League\Flysystem\AdapterInterface;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
Expand Down Expand Up @@ -435,6 +436,8 @@ public function url($path)
return $this->driver->getUrl($path);
} elseif ($adapter instanceof AwsS3Adapter) {
return $this->getAwsUrl($adapter, $path);
} elseif ($adapter instanceof Ftp) {
return $this->getFtpUrl($path);
} elseif ($adapter instanceof LocalAdapter) {
return $this->getLocalUrl($path);
} else {
Expand Down Expand Up @@ -487,6 +490,23 @@ protected function getAwsUrl($adapter, $path)
);
}

/**
* Get the URL for the file at the given path.
*
* @param string $path
* @return string
*/
protected function getFtpUrl($path)
{
$config = $this->driver->getConfig();

if ($config->has('url')) {
return $this->concatPathToUrl($config->get('url'), $path);
}

return $path;
}

/**
* Get the URL for the file at the given path.
*
Expand Down

0 comments on commit 4deaad3

Please sign in to comment.