Skip to content

Commit

Permalink
Merge pull request #71 from nao-pon/patch-5
Browse files Browse the repository at this point in the history
support an option `'temporary'` of getContentUrl()
  • Loading branch information
barryvdh authored Jul 16, 2018
2 parents cdf3399 + c54b3d9 commit ed6d227
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,15 @@ public function getImageSize($path, $mime = '')
public function getContentUrl($hash, $options = array())
{
if (($file = $this->file($hash)) == false || !isset($file['url']) || !$file['url'] || $file['url'] == 1) {
if ($file && !empty($file['url']) && !empty($options['temporary'])) {
return parent::getContentUrl($hash, $options);
}
$path = $this->decode($hash);
return $this->fs->getUrl($path);
if ($res = $this->fs->getUrl($path) || empty($options['temporary'])) {
return $res;
} else {
return parent::getContentUrl($hash, $options);
}
}
return $file['url'];
}
Expand Down

0 comments on commit ed6d227

Please sign in to comment.