Skip to content
Snippets Groups Projects
Commit bb465a7a authored by Robin Appelman's avatar Robin Appelman Committed by Thomas Müller
Browse files

Catch exceptions while creating shared mounts (#25077)

parent dcee5284
No related branches found
No related tags found
No related merge requests found
......@@ -115,7 +115,8 @@ class Application extends App {
$server = $c->query('ServerContainer');
return new MountProvider(
$server->getConfig(),
$server->getShareManager()
$server->getShareManager(),
$server->getLogger()
);
});
......
......@@ -26,6 +26,7 @@ namespace OCA\Files_Sharing;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
use OCP\Share\IManager;
......@@ -40,13 +41,20 @@ class MountProvider implements IMountProvider {
*/
protected $shareManager;
/**
* @var ILogger
*/
protected $logger;
/**
* @param \OCP\IConfig $config
* @param IManager $shareManager
* @param ILogger $logger
*/
public function __construct(IConfig $config, IManager $shareManager) {
public function __construct(IConfig $config, IManager $shareManager, ILogger $logger) {
$this->config = $config;
$this->shareManager = $shareManager;
$this->logger = $logger;
}
......@@ -67,15 +75,20 @@ class MountProvider implements IMountProvider {
$mounts = [];
foreach ($shares as $share) {
$mounts[] = new SharedMount(
'\OC\Files\Storage\Shared',
$mounts,
[
'user' => $user->getUID(),
'newShare' => $share,
],
$storageFactory
);
try {
$mounts[] = new SharedMount(
'\OC\Files\Storage\Shared',
$mounts,
[
'user' => $user->getUID(),
'newShare' => $share,
],
$storageFactory
);
} catch (\Exception $e) {
$this->logger->logException($e);
$this->logger->error('Error while trying to create shared mount');
}
}
// array_filter removes the null values from the array
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment