From d8f465b52d6019e0cf970573c57240d801575dc9 Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 3 Nov 2025 12:46:35 -0500 Subject: [PATCH] fix(public.php): Actually pass specified HTTP code for exceptions Signed-off-by: Josh --- public.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public.php b/public.php index 8ae6deff203..d8cdd347170 100644 --- a/public.php +++ b/public.php @@ -89,10 +89,14 @@ try { $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; require_once $file; } catch (Exception $ex) { - $status = 500; - if ($ex instanceof ServiceUnavailableException) { + if ($ex instanceof ServiceUnavailableException && $ex->getCode === 0) { $status = 503; } + if ($ex->getCode() > 0) { + $status = $ex->getCode(); + } else { + $status = 500; + } //show the user a detailed error page Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'public', 'exception' => $ex]); Server::get(ITemplateManager::class)->printExceptionErrorPage($ex, $status);