Skip to content

Commit 80f053a

Browse files
committed
fix: Replace the TypeError to prevent exposing the installation path
Signed-off-by: Daniel Kesselberg <[email protected]>
1 parent 4d61fd2 commit 80f053a

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

apps/dav/lib/Connector/Sabre/Server.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Sabre\DAV\Exception;
1111
use Sabre\DAV\Version;
12+
use TypeError;
1213

1314
/**
1415
* Class \OCA\DAV\Connector\Sabre\Server
@@ -47,20 +48,17 @@ public function start() {
4748
$this->httpRequest->setBaseUrl($this->getBaseUri());
4849
$this->invokeMethod($this->httpRequest, $this->httpResponse);
4950
} catch (\Throwable $e) {
50-
if ($e instanceof \TypeError) {
51+
try {
52+
$this->emit('exception', [$e]);
53+
} catch (\Exception $ignore) {
54+
}
55+
56+
if ($e instanceof TypeError) {
5157
/*
5258
* The TypeError includes the file path where the error occurred,
5359
* potentially revealing the installation directory.
54-
*
55-
* By re-throwing the exception, we ensure that the
56-
* default exception handler processes it.
5760
*/
58-
throw $e;
59-
}
60-
61-
try {
62-
$this->emit('exception', [$e]);
63-
} catch (\Exception $ignore) {
61+
$e = new TypeError('A type error occurred. For more details, please refer to the logs, which provide additional context about the type error.');
6462
}
6563

6664
$DOM = new \DOMDocument('1.0', 'utf-8');

0 commit comments

Comments
 (0)