Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: catch all errors when getting rich workspace content
Signed-off-by: Robin Appelman <robin@icewind.nl>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
icewind1991 authored and juliusknorr committed Aug 26, 2024
commit ba44539f43d5dcd3cb4a54e4ab24cd2bbc758a5a
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