[CORE] Added documentation and fixed typo in attachments action

This commit is contained in:
Miguel Dantas 2019-07-15 03:20:55 +01:00 committed by Diogo Cordeiro
parent ee8bac9ad7
commit d295d8b43c
4 changed files with 10 additions and 2 deletions

View File

@ -205,6 +205,8 @@ class AttachmentAction extends ManagedAction
* Include $filepath in the response, for viewing and downloading. * Include $filepath in the response, for viewing and downloading.
* If provided, $filesize is used to size the HTTP request, * If provided, $filesize is used to size the HTTP request,
* otherwise it's value is calculated * 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) { static function sendFile(string $filepath, $filesize) {
if (is_string(common_config('site', 'x-static-delivery'))) { if (is_string(common_config('site', 'x-static-delivery'))) {

View File

@ -21,7 +21,7 @@ class Attachment_downloadAction extends AttachmentAction
$mimetype = $this->attachment->getFileOrThumbnailMimetype(); $mimetype = $this->attachment->getFileOrThumbnailMimetype();
if (empty($filepath)) { if (empty($filepath)) {
$thiis->clientError(_('No such attachment'), 404); $this->clientError(_('No such attachment'), 404);
} }
$filename = MediaFile::getDisplayName($this->attachment); $filename = MediaFile::getDisplayName($this->attachment);

View File

@ -53,6 +53,12 @@ class Attachment_thumbnailAction extends AttachmentAction
$this->thumb_c = $this->boolean('c'); $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() public function showPage()
{ {

View File

@ -19,7 +19,7 @@ class Attachment_viewAction extends AttachmentAction
$mimetype = $this->attachment->getFileOrThumbnailMimetype(); $mimetype = $this->attachment->getFileOrThumbnailMimetype();
if (empty($filepath)) { if (empty($filepath)) {
$thiis->clientError(_('No such attachment'), 404); $this->clientError(_('No such attachment'), 404);
} }
$filename = MediaFile::getDisplayName($this->attachment); $filename = MediaFile::getDisplayName($this->attachment);