Set content type when downloading log file to force download in some browsers (#25382)
This commit is contained in:
parent
dc21a38a85
commit
d769e718a5
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue