X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a6c6c6e300c60e4dd2b02501c827571da1adf1be..refs/pull/255/head:/app/Page.php diff --git a/app/Page.php b/app/Page.php index 94bcce2b5..3ee9e90f4 100644 --- a/app/Page.php +++ b/app/Page.php @@ -55,12 +55,12 @@ class Page extends Entity } /** - * Get the files attached to this page. + * Get the attachments assigned to this page. * @return \Illuminate\Database\Eloquent\Relations\HasMany */ - public function files() + public function attachments() { - return $this->hasMany(File::class, 'uploaded_to')->orderBy('order', 'asc'); + return $this->hasMany(Attachment::class, 'uploaded_to')->orderBy('order', 'asc'); } /** @@ -72,13 +72,13 @@ class Page extends Entity { $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug; $midText = $this->draft ? '/draft/' : '/page/'; - $idComponent = $this->draft ? $this->id : $this->slug; + $idComponent = $this->draft ? $this->id : urlencode($this->slug); if ($path !== false) { - return baseUrl('/books/' . $bookSlug . $midText . $idComponent . '/' . trim($path, '/')); + return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/')); } - return baseUrl('/books/' . $bookSlug . $midText . $idComponent); + return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent); } /**