Skip to content

Commit fe766dc

Browse files
committed
Lower log to debug for connections aborted by the client
Signed-off-by: Côme Chilliet <[email protected]>
1 parent cb2a6d6 commit fe766dc

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
'OCP\\Files\\Config\\IMountProviderCollection' => $baseDir . '/lib/public/Files/Config/IMountProviderCollection.php',
275275
'OCP\\Files\\Config\\IRootMountProvider' => $baseDir . '/lib/public/Files/Config/IRootMountProvider.php',
276276
'OCP\\Files\\Config\\IUserMountCache' => $baseDir . '/lib/public/Files/Config/IUserMountCache.php',
277+
'OCP\\Files\\ConnectionLostException' => $baseDir . '/lib/public/Files/ConnectionLostException.php',
277278
'OCP\\Files\\DavUtil' => $baseDir . '/lib/public/Files/DavUtil.php',
278279
'OCP\\Files\\EmptyFileNameException' => $baseDir . '/lib/public/Files/EmptyFileNameException.php',
279280
'OCP\\Files\\EntityTooLargeException' => $baseDir . '/lib/public/Files/EntityTooLargeException.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
307307
'OCP\\Files\\Config\\IMountProviderCollection' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IMountProviderCollection.php',
308308
'OCP\\Files\\Config\\IRootMountProvider' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IRootMountProvider.php',
309309
'OCP\\Files\\Config\\IUserMountCache' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IUserMountCache.php',
310+
'OCP\\Files\\ConnectionLostException' => __DIR__ . '/../../..' . '/lib/public/Files/ConnectionLostException.php',
310311
'OCP\\Files\\DavUtil' => __DIR__ . '/../../..' . '/lib/public/Files/DavUtil.php',
311312
'OCP\\Files\\EmptyFileNameException' => __DIR__ . '/../../..' . '/lib/public/Files/EmptyFileNameException.php',
312313
'OCP\\Files\\EntityTooLargeException' => __DIR__ . '/../../..' . '/lib/public/Files/EntityTooLargeException.php',

lib/private/Files/View.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
use OCA\Files_Sharing\SharedMount;
5454
use OCP\Constants;
5555
use OCP\Files\Cache\ICacheEntry;
56+
use OCP\Files\ConnectionLostException;
5657
use OCP\Files\EmptyFileNameException;
5758
use OCP\Files\FileNameTooLongException;
5859
use OCP\Files\InvalidCharacterInPathException;
@@ -496,7 +497,7 @@ public function readfilePart($path, $from, $to) {
496497
private function checkConnectionStatus(): void {
497498
$connectionStatus = \connection_status();
498499
if ($connectionStatus !== 0) {
499-
throw new \RuntimeException("Connection lost. Status: $connectionStatus");
500+
throw new ConnectionLostException("Connection lost. Status: $connectionStatus");
500501
}
501502
}
502503

lib/private/legacy/OC_Files.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ public static function get($dir, $files, $params = null) {
233233
OC::$server->getLogger()->logException($ex);
234234
$l = \OC::$server->getL10N('lib');
235235
\OC_Template::printErrorPage($l->t('Cannot download file'), $ex->getMessage(), 200);
236+
} catch (\OCP\Files\ConnectionLostException $ex) {
237+
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
238+
OC::$server->getLogger()->logException($ex, ['level' => \OCP\ILogger::DEBUG]);
239+
\OC_Template::printErrorPage('Connection lost', $ex->getMessage(), 200);
236240
} catch (\Exception $ex) {
237241
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
238242
OC::$server->getLogger()->logException($ex);

0 commit comments

Comments
 (0)