From 6779729174acd4f872967ae0482a1701f3a1dd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Sat, 14 Sep 2024 14:20:49 +0200 Subject: [PATCH] fix: Do not try to set HTTP response code on already closed connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids a PHP warning in the logs about trying to set the response code while the output already started. It’s useless to try to print an error page anyway in this situation because the connection was closed already. Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Files.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index 76d61a985581f..9870787e6f620 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -198,7 +198,8 @@ public static function get($dir, $files, $params = null) { } catch (\OCP\Files\ConnectionLostException $ex) { self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); OC::$server->getLogger()->logException($ex, ['level' => \OCP\ILogger::DEBUG]); - \OC_Template::printErrorPage('Connection lost', $ex->getMessage(), 200); + /* We do not print anything here, the connection is already closed */ + die(); } catch (\Exception $ex) { self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); OC::$server->getLogger()->logException($ex);