X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ac0b29fb6d05d6e943419b91fdbc09a59e20c89f..refs/pull/232/head:/app/File.php diff --git a/app/File.php b/app/File.php index 055f217bd..e9b77d2ea 100644 --- a/app/File.php +++ b/app/File.php @@ -5,6 +5,16 @@ class File extends Ownable { protected $fillable = ['name', 'order']; + /** + * Get the downloadable file name for this upload. + * @return mixed|string + */ + public function getFileName() + { + if (str_contains($this->name, '.')) return $this->name; + return $this->name . '.' . $this->extension; + } + /** * Get the page this file was uploaded to. * @return Page @@ -20,7 +30,7 @@ class File extends Ownable */ public function getUrl() { - return '/files/' . $this->id; + return baseUrl('/files/' . $this->id); } }