summaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-05-17 11:46:28 +0200
committerJulius Härtl <jus@bitgrid.net>2018-05-17 12:21:57 +0200
commit5b3ca8f7c69f5fd44e0970f2bf10eb3ba4dad7ab (patch)
treefaf21d3bf4e277406d9a448a1b8c93705e505fb2 /apps/theming
parent2bf51c7b9eee1da51e7c0f7a5cbcd76d06fdc9fa (diff)
downloadnextcloud-server-5b3ca8f7c69f5fd44e0970f2bf10eb3ba4dad7ab.tar.gz
nextcloud-server-5b3ca8f7c69f5fd44e0970f2bf10eb3ba4dad7ab.zip
Add Content-Disposition header
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/lib/Controller/ThemingController.php1
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php4
2 files changed, 4 insertions, 1 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 5e1e3d08dc9..e4a8f0b5036 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -354,6 +354,7 @@ class ThemingController extends Controller {
$response->addHeader('Expires', $expires->format(\DateTime::RFC2822));
$response->addHeader('Pragma', 'cache');
$response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', ''));
+ $response->addHeader('Content-Disposition', 'attachment; filename="' . $key . '"');
return $response;
}
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 6d756c13a5a..eddf5bc56dc 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -305,7 +305,7 @@ class ThemingControllerTest extends TestCase {
$destination = \OC::$server->getTempManager()->getTemporaryFolder();
touch($tmpLogo);
- copy(__DIR__ . '/../../../../tests/data/testimagelarge.svg', $tmpLogo);
+ copy(__DIR__ . '/../../../../tests/data/testimage.png', $tmpLogo);
$this->request
->expects($this->at(0))
->method('getParam')
@@ -701,6 +701,7 @@ class ThemingControllerTest extends TestCase {
$expected->addHeader('Expires', $expires->format(\DateTime::RFC2822));
$expected->addHeader('Pragma', 'cache');
$expected->addHeader('Content-Type', 'text/svg');
+ $expected->addHeader('Content-Disposition', 'attachment; filename="logo"');
@$this->assertEquals($expected, $this->themingController->getImage('logo'));
}
@@ -733,6 +734,7 @@ class ThemingControllerTest extends TestCase {
$expected->addHeader('Expires', $expires->format(\DateTime::RFC2822));
$expected->addHeader('Pragma', 'cache');
$expected->addHeader('Content-Type', 'image/png');
+ $expected->addHeader('Content-Disposition', 'attachment; filename="background"');
@$this->assertEquals($expected, $this->themingController->getImage('background'));
}