|
|
|
@ -8,6 +8,7 @@ |
|
|
|
|
* @author Lukas Reschke <lukas@statuscode.ch> |
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl> |
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu> |
|
|
|
|
* @author Kate Döen <kate.doeen@nextcloud.com> |
|
|
|
|
* |
|
|
|
|
* @license AGPL-3.0 |
|
|
|
|
* |
|
|
|
@ -28,6 +29,7 @@ namespace OCA\Settings\Controller; |
|
|
|
|
|
|
|
|
|
use OC\Log; |
|
|
|
|
use OCP\AppFramework\Controller; |
|
|
|
|
use OCP\AppFramework\Http; |
|
|
|
|
use OCP\AppFramework\Http\StreamResponse; |
|
|
|
|
use OCP\IRequest; |
|
|
|
|
|
|
|
|
@ -46,15 +48,19 @@ class LogSettingsController extends Controller { |
|
|
|
|
* |
|
|
|
|
* @NoCSRFRequired |
|
|
|
|
* |
|
|
|
|
* @return StreamResponse |
|
|
|
|
* @psalm-suppress MoreSpecificReturnType The value of Content-Disposition is not relevant |
|
|
|
|
* @psalm-suppress LessSpecificReturnStatement The value of Content-Disposition is not relevant |
|
|
|
|
* @return StreamResponse<Http::STATUS_OK, array{Content-Type: 'application/octet-stream', 'Content-Disposition': string}> |
|
|
|
|
*/ |
|
|
|
|
public function download() { |
|
|
|
|
if (!$this->log instanceof Log) { |
|
|
|
|
throw new \UnexpectedValueException('Log file not available'); |
|
|
|
|
} |
|
|
|
|
$resp = new StreamResponse($this->log->getLogPath()); |
|
|
|
|
$resp->addHeader('Content-Type', 'application/octet-stream'); |
|
|
|
|
$resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"'); |
|
|
|
|
$resp->setHeaders([ |
|
|
|
|
'Content-Type' => 'application/octet-stream', |
|
|
|
|
'Content-Disposition' => 'attachment; filename="nextcloud.log"', |
|
|
|
|
]); |
|
|
|
|
return $resp; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|