Skip to content

Commit 76fff24

Browse files
committed
Fix readfile with exit
1 parent c007e2c commit 76fff24

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

appinfo/info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<description>
88
<![CDATA[Files sharing use file stored path. Now you cau use nextcloud as your CDN origin.
99
What you need to do is just share your files, then click Open Sharing Path to access from files dropdown actions menu. ]]></description>
10-
<version>0.2.0</version>
10+
<version>0.2.1</version>
1111
<licence>agpl</licence>
1212
<author mail="[email protected]">Rookie0</author>
1313
<namespace>SharingPath</namespace>
@@ -19,7 +19,7 @@
1919
https://user-images.githubusercontent.com/5813232/61992484-bc745d80-b091-11e9-84bc-005a2a6caf14.png
2020
</screenshot>
2121
<dependencies>
22-
<nextcloud min-version="15" max-version="18"/>
22+
<nextcloud min-version="15" max-version="19"/>
2323
</dependencies>
2424

2525
<settings>

lib/Controller/PathController.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,19 @@ public function handle($uid, $path)
135135
}
136136
}
137137

138+
// FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
138139
$view->readfile($path);
140+
exit;
139141
} catch (NotFoundException $e) {
140142
http_response_code(404);
141-
$this->logger->warning("request user {$uid} file {$path} not found.");
143+
$this->logger->warning("request user {$uid} file {$path} not found.", ['app' => Application::APP_ID]);
142144
exit;
143145
} catch (\Exception $e) {
144146
http_response_code(500);
145-
$this->logger->error("request user {$uid} file {$path} failed: " . $e->getMessage(), ['extra_context' => $e->getTrace()]);
147+
$this->logger->error("request user {$uid} file {$path} failed: " . $e->getMessage(), [
148+
'app' => Application::APP_ID,
149+
'extra_context' => $e->getTrace(),
150+
]);
146151
exit;
147152
}
148153
}

0 commit comments

Comments
 (0)