diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-07-06 22:47:16 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-07-06 22:47:16 +0200 |
commit | d769e718a58ff76a85f032913728936d77581452 (patch) | |
tree | 00ebfbeb8d5a153488d141c25271125b6c1ebd45 | |
parent | dc21a38a8598f1efe2ee43ec5648b49f7b7853fd (diff) | |
download | nextcloud-server-d769e718a58ff76a85f032913728936d77581452.tar.gz nextcloud-server-d769e718a58ff76a85f032913728936d77581452.zip |
Set content type when downloading log file to force download in some browsers (#25382)
-rw-r--r-- | settings/Controller/LogSettingsController.php | 1 | ||||
-rw-r--r-- | tests/Settings/Controller/LogSettingsControllerTest.php | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/settings/Controller/LogSettingsController.php b/settings/Controller/LogSettingsController.php index 4863c2369be..f9a69fa38c8 100644 --- a/settings/Controller/LogSettingsController.php +++ b/settings/Controller/LogSettingsController.php @@ -105,6 +105,7 @@ class LogSettingsController extends Controller { */ public function download() { $resp = new StreamResponse(\OC\Log\Owncloud::getLogFilePath()); + $resp->addHeader('Content-Type', 'application/octet-stream'); $resp->addHeader('Content-Disposition', 'attachment; filename="owncloud.log"'); return $resp; } diff --git a/tests/Settings/Controller/LogSettingsControllerTest.php b/tests/Settings/Controller/LogSettingsControllerTest.php index 092c04aecc7..1660369fafe 100644 --- a/tests/Settings/Controller/LogSettingsControllerTest.php +++ b/tests/Settings/Controller/LogSettingsControllerTest.php @@ -71,5 +71,8 @@ class LogSettingsControllerTest extends \Test\TestCase { $response = $this->logSettingsController->download(); $this->assertInstanceOf('\OCP\AppFramework\Http\StreamResponse', $response); + $headers = $response->getHeaders(); + $this->assertEquals('application/octet-stream', $headers['Content-Type']); + $this->assertEquals('attachment; filename="owncloud.log"', $headers['Content-Disposition']); } } |