Skip to content

Commit 7bf9848

Browse files
Merge pull request #50600 from nextcloud/backport/50549/stable29
2 parents 547dc41 + 7246b5d commit 7bf9848

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/private/legacy/OC_Files.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
use OCP\Files\Events\BeforeZipCreatedEvent;
4949
use OCP\Files\IRootFolder;
5050
use OCP\Lock\ILockingProvider;
51+
use Psr\Log\LoggerInterface;
5152

5253
/**
5354
* Class for file server access
@@ -237,12 +238,15 @@ public static function get($dir, $files, $params = null) {
237238
die();
238239
} catch (\Exception $ex) {
239240
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
240-
OC::$server->getLogger()->logException($ex);
241-
$l = \OC::$server->getL10N('lib');
242-
$hint = method_exists($ex, 'getHint') ? $ex->getHint() : '';
243-
if ($event && $event->getErrorMessage() !== null) {
241+
$logger = \OCP\Server::get(LoggerInterface::class);
242+
$logger->error($ex->getMessage(), ['exception' => $ex]);
243+
$l = \OCP\Server::get(\OCP\L10N\IFactory::class)->get('lib');
244+
245+
$hint = ($ex instanceof \OCP\HintException) ? $ex->getHint() : '';
246+
if (isset($event) && $event->getErrorMessage() !== null) {
244247
$hint .= ' ' . $event->getErrorMessage();
245248
}
249+
246250
\OC_Template::printErrorPage($l->t('Cannot download file'), $hint, 200);
247251
}
248252
}

0 commit comments

Comments
 (0)