Skip to content

Commit

Permalink
Merge pull request #6246 from nextcloud/backport/6243/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: catch all errors when getting rich workspace content
  • Loading branch information
mejo- committed Aug 28, 2024
2 parents c9047f9 + 3949662 commit 2d0c448
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/DAV/WorkspacePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace OCA\Text\DAV;

use Exception;
use OC\Files\Node\File;
use OC\Files\Node\Folder;
use OCA\DAV\Connector\Sabre\Directory;
Expand All @@ -37,6 +38,7 @@
use OCP\Files\StorageNotAvailableException;
use OCP\IConfig;
use OCP\Lock\LockedException;
use Psr\Log\LoggerInterface;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\Server;
Expand All @@ -55,16 +57,20 @@ class WorkspacePlugin extends ServerPlugin {
/** @var IRootFolder */
private $rootFolder;

/** @var LoggerInterface */
private $logger;

/** @var IConfig */
private $config;

/** @var string|null */
private $userId;

public function __construct(WorkspaceService $workspaceService, IRootFolder $rootFolder, IConfig $config, $userId) {
public function __construct(WorkspaceService $workspaceService, IRootFolder $rootFolder, IConfig $config, LoggerInterface $logger, $userId) {
$this->workspaceService = $workspaceService;
$this->rootFolder = $rootFolder;
$this->config = $config;
$this->logger = $logger;
$this->userId = $userId;
}

Expand Down Expand Up @@ -123,6 +129,10 @@ public function propFind(PropFind $propFind, INode $node) {
return $file->getContent();
}
} catch (GenericFileException|NotPermittedException|LockedException) {
} catch (Exception $e) {
$this->logger->error($e->getMessage(), [
'exception' => $e,
]);
}

return '';
Expand Down

0 comments on commit 2d0c448

Please sign in to comment.