Set content-type to "application/octet-stream"
Some browsers such as Firefox on Microsoft Windows otherwise do offer to open the file directly which is kinda silly.
This commit is contained in:
parent
f7a69c765a
commit
700a57d8b6
|
@ -105,7 +105,8 @@ class LogSettingsController extends Controller {
|
||||||
*/
|
*/
|
||||||
public function download() {
|
public function download() {
|
||||||
$resp = new StreamResponse(\OC\Log\Owncloud::getLogFilePath());
|
$resp = new StreamResponse(\OC\Log\Owncloud::getLogFilePath());
|
||||||
$resp->addHeader('Content-Disposition', 'attachment; filename="owncloud.log"');
|
$resp->addHeader('Content-Type', 'application/octet-stream');
|
||||||
|
$resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"');
|
||||||
return $resp;
|
return $resp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Tests\Settings\Controller;
|
||||||
|
|
||||||
use \OC\Settings\Application;
|
use \OC\Settings\Application;
|
||||||
use OC\Settings\Controller\LogSettingsController;
|
use OC\Settings\Controller\LogSettingsController;
|
||||||
|
use OCP\AppFramework\Http\StreamResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package Tests\Settings\Controller
|
* @package Tests\Settings\Controller
|
||||||
|
@ -70,6 +71,9 @@ class LogSettingsControllerTest extends \Test\TestCase {
|
||||||
public function testDownload() {
|
public function testDownload() {
|
||||||
$response = $this->logSettingsController->download();
|
$response = $this->logSettingsController->download();
|
||||||
|
|
||||||
$this->assertInstanceOf('\OCP\AppFramework\Http\StreamResponse', $response);
|
$expected = new StreamResponse(\OC\Log\Owncloud::getLogFilePath());
|
||||||
|
$expected->addHeader('Content-Type', 'application/octet-stream');
|
||||||
|
$expected->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"');
|
||||||
|
$this->assertEquals($expected, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue