diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-07-16 08:29:44 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-08-01 13:40:09 +0000 |
commit | da9aac26a30de4e9023840421be631d3ea894592 (patch) | |
tree | ca441b3d1eaf734d7732abe0d37a17ce70177406 | |
parent | c5f876b66b1a30d3f0e47bc44e131378bf561337 (diff) | |
download | nextcloud-server-da9aac26a30de4e9023840421be631d3ea894592.tar.gz nextcloud-server-da9aac26a30de4e9023840421be631d3ea894592.zip |
fix(dav): drop unwanted RemoteException class
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
-rw-r--r-- | public.php | 18 | ||||
-rw-r--r-- | remote.php | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/public.php b/public.php index 2bf710c72fc..f422a80deee 100644 --- a/public.php +++ b/public.php @@ -58,30 +58,33 @@ try { // this policy with a softer one if debug mode is enabled. header("Content-Security-Policy: default-src 'none';"); + // Check if Nextcloud is in maintenance mode if (\OCP\Util::needUpgrade()) { // since the behavior of apps or remotes are unpredictable during // an upgrade, return a 503 directly - throw new RemoteException('Service unavailable', 503); + throw new \Exception('Service unavailable', 503); } $request = \OC::$server->getRequest(); $pathInfo = $request->getPathInfo(); if ($pathInfo === false || $pathInfo === '') { - throw new RemoteException('Path not found', 404); + throw new \Exception('Path not found', 404); } + + // Extract the service from the path if (!$pos = strpos($pathInfo, '/', 1)) { $pos = strlen($pathInfo); } $service = substr($pathInfo, 1, $pos - 1); + // Resolve the service to a file $file = resolveService($service); - if (!$file) { - throw new RemoteException('Path not found', 404); + throw new \Exception('Path not found', 404); } + // Extract the app from the service file $file = ltrim($file, '/'); - $parts = explode('/', $file, 2); $app = $parts[0]; @@ -91,9 +94,12 @@ try { OC_App::loadApps(['extended_authentication']); OC_App::loadApps(['filesystem', 'logging']); + // Check if the app is enabled if (!\OC::$server->getAppManager()->isInstalled($app)) { - throw new RemoteException('App not installed: ' . $app); + throw new \Exception('App not installed: ' . $app); } + + // Load the app OC_App::loadApp($app); OC_User::setIncognitoMode(true); diff --git a/remote.php b/remote.php index 03575627dc5..773ae0adc0e 100644 --- a/remote.php +++ b/remote.php @@ -43,7 +43,7 @@ use Sabre\DAV\Server; * Dummy exception class to be use locally to identify certain conditions * Will not be logged to avoid DoS */ -class RemoteException extends Exception { +class RemoteException extends \Exception { } /** |