mirror of
https://github.com/nextcloud/server.git
synced 2026-02-17 09:51:38 -05:00
fix: Replace the TypeError to prevent exposing the installation path
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
205b597295
commit
cb22b3f63e
1 changed files with 8 additions and 10 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue