diff options
author | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-07-08 09:16:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-08 09:16:11 +0200 |
commit | bf9524e3303649be379040e031f01de10d3104a6 (patch) | |
tree | b1007b0256f71cddaa9c2914d595aa2939ff286b | |
parent | 7b92dd2cca9533a0dcde73d01e07b1ed2cdb3dae (diff) | |
download | nextcloud-server-bf9524e3303649be379040e031f01de10d3104a6.tar.gz nextcloud-server-bf9524e3303649be379040e031f01de10d3104a6.zip |
[stable8.1] Set content type when downloading log file to force download in some browsers (#25382) (#25400)
-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 cae0d419e2b..4f3db00295b 100644 --- a/settings/controller/logsettingscontroller.php +++ b/settings/controller/logsettingscontroller.php @@ -103,6 +103,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 60680ba4647..88d5d9bf93a 100644 --- a/tests/settings/controller/logsettingscontrollertest.php +++ b/tests/settings/controller/logsettingscontrollertest.php @@ -70,5 +70,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']); } } |