Skip to content

Commit

Permalink
fix: Replace the TypeError to prevent exposing the installation path
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb authored and backportbot[bot] committed Feb 11, 2025
1 parent 205b597 commit cb22b3f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions apps/dav/lib/Connector/Sabre/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Sabre\DAV\Exception;
use Sabre\DAV\Version;
use TypeError;

/**
* Class \OCA\DAV\Connector\Sabre\Server
Expand Down Expand Up @@ -47,20 +48,17 @@ public function start() {
$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');
Expand Down

0 comments on commit cb22b3f

Please sign in to comment.