Export CSV files with .csv extension
refs #2808 Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
This commit is contained in:
parent
d11775a6b8
commit
d76a18dd91
|
@ -45,7 +45,13 @@ class Controller extends IcingaWebController
|
|||
}
|
||||
if ($this->_getParam('format') === 'csv'
|
||||
|| $this->_request->getHeader('Accept') === 'text/csv') {
|
||||
Csv::fromQuery($query)->dump();
|
||||
$response = $this->getResponse();
|
||||
$response
|
||||
->setHeader('Content-Type', 'text/csv')
|
||||
->setHeader('Cache-Control', 'no-store')
|
||||
->setHeader('Content-Disposition', 'attachment; filename=' . $this->getRequest()->getActionName() . '.csv')
|
||||
->appendBody((string) Csv::fromQuery($query))
|
||||
->sendResponse();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue