summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-06-20 22:11:05 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-06-20 22:11:05 +0200
commitbb465a7ab45c897291deb27cf4329b06cc4857eb (patch)
treec1a85124d1348205e8fc1c19172f2fce84c7feb7
parentdcee5284828bea459e69448ac5f3363a584cab73 (diff)
downloadnextcloud-server-bb465a7ab45c897291deb27cf4329b06cc4857eb.tar.gz
nextcloud-server-bb465a7ab45c897291deb27cf4329b06cc4857eb.zip
Catch exceptions while creating shared mounts (#25077)
-rw-r--r--apps/files_sharing/lib/AppInfo/Application.php3
-rw-r--r--apps/files_sharing/lib/MountProvider.php33
2 files changed, 25 insertions, 11 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php
index 2907ceaaea2..fda16c7acac 100644
--- a/apps/files_sharing/lib/AppInfo/Application.php
+++ b/apps/files_sharing/lib/AppInfo/Application.php
@@ -115,7 +115,8 @@ class Application extends App {
$server = $c->query('ServerContainer');
return new MountProvider(
$server->getConfig(),
- $server->getShareManager()
+ $server->getShareManager(),
+ $server->getLogger()
);
});
diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php
index d8f355f2fd3..a9ae48860c2 100644
--- a/apps/files_sharing/lib/MountProvider.php
+++ b/apps/files_sharing/lib/MountProvider.php
@@ -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;
@@ -41,12 +42,19 @@ 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