Skip to content

Commit

Permalink
fix: Do not try to set HTTP response code on already closed connection
Browse files Browse the repository at this point in the history
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 <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc authored and backportbot[bot] committed Sep 14, 2024
1 parent a8522a7 commit 045dd40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/private/legacy/OC_Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,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);
Expand Down

0 comments on commit 045dd40

Please sign in to comment.