Skip to content

Commit

Permalink
Merge pull request #50600 from nextcloud/backport/50549/stable29
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Feb 1, 2025
2 parents 547dc41 + 7246b5d commit 7bf9848
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/private/legacy/OC_Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
use OCP\Files\Events\BeforeZipCreatedEvent;
use OCP\Files\IRootFolder;
use OCP\Lock\ILockingProvider;
use Psr\Log\LoggerInterface;

/**
* Class for file server access
Expand Down Expand Up @@ -237,12 +238,15 @@ public static function get($dir, $files, $params = null) {
die();
} catch (\Exception $ex) {
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
OC::$server->getLogger()->logException($ex);
$l = \OC::$server->getL10N('lib');
$hint = method_exists($ex, 'getHint') ? $ex->getHint() : '';
if ($event && $event->getErrorMessage() !== null) {
$logger = \OCP\Server::get(LoggerInterface::class);
$logger->error($ex->getMessage(), ['exception' => $ex]);
$l = \OCP\Server::get(\OCP\L10N\IFactory::class)->get('lib');

$hint = ($ex instanceof \OCP\HintException) ? $ex->getHint() : '';
if (isset($event) && $event->getErrorMessage() !== null) {
$hint .= ' ' . $event->getErrorMessage();
}

\OC_Template::printErrorPage($l->t('Cannot download file'), $hint, 200);
}
}
Expand Down

0 comments on commit 7bf9848

Please sign in to comment.