123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- defined('GNUSOCIAL') || die();
- class Attachment_downloadAction extends AttachmentAction
- {
- public function showPage(): void
- {
-
-
-
- @ini_set('display_errors', 0);
- if ($this->attachment->isLocal()) {
- try {
- $this->filepath = $this->attachment->getFileOrThumbnailPath();
- } catch (Exception $e) {
- $this->clientError(
- _m('Requested local URL for a file that is not stored locally.'),
- 404
- );
- }
- common_send_file(
- $this->filepath,
- $this->mimetype,
- $this->filename,
- 'attachment'
- );
- } else {
- common_redirect($this->attachment->getUrl(), 303);
- }
- }
- }
|