Browse Source
fix: Replace the TypeError to prevent exposing the installation path
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
pull/50498/head
Daniel Kesselberg
10 months ago
No known key found for this signature in database
GPG Key ID: 4A81C29F63464E8F
1 changed files with
8 additions and
10 deletions
-
apps/dav/lib/Connector/Sabre/Server.php
|
|
|
@ -9,6 +9,7 @@ namespace OCA\DAV\Connector\Sabre; |
|
|
|
|
|
|
|
use Sabre\DAV\Exception; |
|
|
|
use Sabre\DAV\Version; |
|
|
|
use TypeError; |
|
|
|
|
|
|
|
/** |
|
|
|
* Class \OCA\DAV\Connector\Sabre\Server |
|
|
|
@ -47,20 +48,17 @@ class Server extends \Sabre\DAV\Server { |
|
|
|
$this->httpRequest->setBaseUrl($this->getBaseUri()); |
|
|
|
$this->invokeMethod($this->httpRequest, $this->httpResponse); |
|
|
|
} catch (\Throwable $e) { |
|
|
|
if ($e instanceof \TypeError) { |
|
|
|
try { |
|
|
|
$this->emit('exception', [$e]); |
|
|
|
} catch (\Exception) { |
|
|
|
} |
|
|
|
|
|
|
|
if ($e instanceof TypeError) { |
|
|
|
/* |
|
|
|
* The TypeError includes the file path where the error occurred, |
|
|
|
* potentially revealing the installation directory. |
|
|
|
* |
|
|
|
* By re-throwing the exception, we ensure that the |
|
|
|
* default exception handler processes it. |
|
|
|
*/ |
|
|
|
throw $e; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
$this->emit('exception', [$e]); |
|
|
|
} catch (\Exception $ignore) { |
|
|
|
$e = new TypeError('A type error occurred. For more details, please refer to the logs, which provide additional context about the type error.'); |
|
|
|
} |
|
|
|
|
|
|
|
$DOM = new \DOMDocument('1.0', 'utf-8'); |
|
|
|
|