Skip to content

Commit 6f77b93

Browse files
committed
fix(settings): Fix log file download return type
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent c626cce commit 6f77b93

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

apps/settings/lib/Controller/LogSettingsController.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ public function __construct(string $appName, IRequest $request, Log $logger) {
4848
*
4949
* @NoCSRFRequired
5050
*
51-
* @psalm-suppress MoreSpecificReturnType The value of Content-Disposition is not relevant
52-
* @psalm-suppress LessSpecificReturnStatement The value of Content-Disposition is not relevant
53-
* @return StreamResponse<Http::STATUS_OK, array{Content-Type: 'application/octet-stream', 'Content-Disposition': string}>
51+
* @return StreamResponse<Http::STATUS_OK, array{Content-Type: 'application/octet-stream', 'Content-Disposition': 'attachment; filename="nextcloud.log"'}>
5452
*
5553
* 200: Logfile returned
5654
*/
5755
public function download() {
5856
if (!$this->log instanceof Log) {
5957
throw new \UnexpectedValueException('Log file not available');
6058
}
61-
$resp = new StreamResponse($this->log->getLogPath());
62-
$resp->setHeaders([
63-
'Content-Type' => 'application/octet-stream',
64-
'Content-Disposition' => 'attachment; filename="nextcloud.log"',
65-
]);
66-
return $resp;
59+
return new StreamResponse(
60+
$this->log->getLogPath(),
61+
Http::STATUS_OK,
62+
[
63+
'Content-Type' => 'application/octet-stream',
64+
'Content-Disposition' => 'attachment; filename="nextcloud.log"',
65+
],
66+
);
6767
}
6868
}

apps/settings/openapi.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
"headers": {
4545
"Content-Disposition": {
4646
"schema": {
47-
"type": "string"
47+
"type": "string",
48+
"enum": [
49+
"attachment; filename=\"nextcloud.log\""
50+
]
4851
}
4952
}
5053
},

0 commit comments

Comments
 (0)