From 6e345c37a9997e0f6fda8fbf5ac4a6ef26343ae4 Mon Sep 17 00:00:00 2001 From: rubencm Date: Fri, 21 Jun 2019 23:59:34 +0000 Subject: [PATCH] [ticket/14285] Don't set cache-control by default PHPBB3-14285 --- phpBB/phpbb/storage/controller/attachment.php | 8 ++++++-- phpBB/phpbb/storage/controller/avatar.php | 2 ++ phpBB/phpbb/storage/controller/controller.php | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/storage/controller/attachment.php b/phpBB/phpbb/storage/controller/attachment.php index c2b027d147..a4bbe49825 100644 --- a/phpBB/phpbb/storage/controller/attachment.php +++ b/phpBB/phpbb/storage/controller/attachment.php @@ -243,6 +243,9 @@ class attachment extends controller ); extract($this->dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars))); + // TODO: The next lines should go better in prepare, also the mimetype is handled by the storage table + // so probably can be removed + // Content-type header $this->response->headers->set('Content-Type', $attachment['mimetype']); @@ -276,9 +279,9 @@ class attachment extends controller */ protected function prepare($file) { - parent::prepare($file); + $this->response->setPivate(); // But default should be private, but make sure of it - $this->response->setPivate(); + parent::prepare($file); } /** @@ -405,6 +408,7 @@ class attachment extends controller /** * Check if downloading item is allowed + * FIXME (See: https://tracker.phpbb.com/browse/PHPBB3-15264 and http://area51.phpbb.com/phpBB/viewtopic.php?f=81&t=51921) */ protected function download_allowed() { diff --git a/phpBB/phpbb/storage/controller/avatar.php b/phpBB/phpbb/storage/controller/avatar.php index c657773374..c89dca95a9 100644 --- a/phpBB/phpbb/storage/controller/avatar.php +++ b/phpBB/phpbb/storage/controller/avatar.php @@ -96,6 +96,8 @@ class avatar extends controller */ protected function prepare($file) { + $this->response->setPublic(); + $disposition = $this->response->headers->makeDisposition( ResponseHeaderBag::DISPOSITION_INLINE, rawurlencode($file) diff --git a/phpBB/phpbb/storage/controller/controller.php b/phpBB/phpbb/storage/controller/controller.php index 5c199ff2cd..050d5a542b 100644 --- a/phpBB/phpbb/storage/controller/controller.php +++ b/phpBB/phpbb/storage/controller/controller.php @@ -119,8 +119,6 @@ class controller */ protected function prepare($file) { - $this->response->setPublic(); - $file_info = $this->storage->file_info($file); if (!$this->response->headers->has('Content-Type'))