From d295d8b43ceb3b7cb60665817d526fe86186302c Mon Sep 17 00:00:00 2001 From: Miguel Dantas Date: Mon, 15 Jul 2019 03:20:55 +0100 Subject: [PATCH] [CORE] Added documentation and fixed typo in attachments action --- actions/attachment.php | 2 ++ actions/attachment_download.php | 2 +- actions/attachment_thumbnail.php | 6 ++++++ actions/attachment_view.php | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/actions/attachment.php b/actions/attachment.php index 993f94b007..ae09a7256f 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -205,6 +205,8 @@ class AttachmentAction extends ManagedAction * Include $filepath in the response, for viewing and downloading. * If provided, $filesize is used to size the HTTP request, * otherwise it's value is calculated + * @param string $filepath the absolute path to the file to send + * @param $filesize optional, calculated if unkown */ static function sendFile(string $filepath, $filesize) { if (is_string(common_config('site', 'x-static-delivery'))) { diff --git a/actions/attachment_download.php b/actions/attachment_download.php index 38ff046943..62d5b43e47 100644 --- a/actions/attachment_download.php +++ b/actions/attachment_download.php @@ -21,7 +21,7 @@ class Attachment_downloadAction extends AttachmentAction $mimetype = $this->attachment->getFileOrThumbnailMimetype(); if (empty($filepath)) { - $thiis->clientError(_('No such attachment'), 404); + $this->clientError(_('No such attachment'), 404); } $filename = MediaFile::getDisplayName($this->attachment); diff --git a/actions/attachment_thumbnail.php b/actions/attachment_thumbnail.php index 2a2ce61d94..a4dad03f68 100644 --- a/actions/attachment_thumbnail.php +++ b/actions/attachment_thumbnail.php @@ -53,6 +53,12 @@ class Attachment_thumbnailAction extends AttachmentAction $this->thumb_c = $this->boolean('c'); } + /** + * Show an inline representation of an attachment of the size + * requested in the GET variables (read in the constructor). Tries + * to send the most appropriate file with the correct size and + * headers or displays an error if it's not possible. + */ public function showPage() { diff --git a/actions/attachment_view.php b/actions/attachment_view.php index e5f1c94da3..cf33c6f6cf 100644 --- a/actions/attachment_view.php +++ b/actions/attachment_view.php @@ -19,7 +19,7 @@ class Attachment_viewAction extends AttachmentAction $mimetype = $this->attachment->getFileOrThumbnailMimetype(); if (empty($filepath)) { - $thiis->clientError(_('No such attachment'), 404); + $this->clientError(_('No such attachment'), 404); } $filename = MediaFile::getDisplayName($this->attachment);