From 003d0dec9342e984d2a35acc4cca4e8eaa9778a1 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Wed, 6 Sep 2023 09:16:55 +0200 Subject: Detect aborted connection in OC\Files\View and stop writing data to the output buffer Signed-off-by: Benjamin Gaussorgues --- lib/private/legacy/OC_Files.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/private/legacy') diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index 7bc1fab94b6..911c713f840 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -230,6 +230,10 @@ class OC_Files { OC::$server->getLogger()->logException($ex); $l = \OC::$server->getL10N('lib'); \OC_Template::printErrorPage($l->t('Cannot download file'), $ex->getMessage(), 200); + } 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); } catch (\Exception $ex) { self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); OC::$server->getLogger()->logException($ex); -- cgit v1.2.3