From bd306bdb9fb43e80f9092784602a9508a7d52031 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 9 May 2016 22:08:36 +0200 Subject: [PATCH] Add /download action for attachments --- actions/attachment_download.php | 20 ++++++++++++++++++++ lib/router.php | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 actions/attachment_download.php diff --git a/actions/attachment_download.php b/actions/attachment_download.php new file mode 100644 index 0000000000..6792c45993 --- /dev/null +++ b/actions/attachment_download.php @@ -0,0 +1,20 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link https:/gnu.io/social + */ +class Attachment_downloadAction extends AttachmentAction +{ + public function showPage() + { + common_redirect($this->attachment->getUrl(), 302); + } +} diff --git a/lib/router.php b/lib/router.php index 5a51f3d7d4..b01c9a7677 100644 --- a/lib/router.php +++ b/lib/router.php @@ -223,6 +223,10 @@ class Router array('action' => 'attachment'), array('attachment' => '[0-9]+')); + $m->connect('attachment/:attachment/download', + array('action' => 'attachment_download'), + array('attachment' => '[0-9]+')); + $m->connect('attachment/:attachment/thumbnail', array('action' => 'attachment_thumbnail'), array('attachment' => '[0-9]+')); -- 2.39.5