summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-06-20 22:11:05 +0200
committerRobin Appelman <icewind@owncloud.com>2016-06-21 12:45:33 +0200
commitfa9ba64552a43448d7394d3e11a60997b00eca48 (patch)
tree7eafce5d3d901d702e30024dfb9e8b7d092daa26 /apps
parent826654bb70c78bd577e71e0d75b5f2ecef6769ff (diff)
downloadnextcloud-server-fa9ba64552a43448d7394d3e11a60997b00eca48.tar.gz
nextcloud-server-fa9ba64552a43448d7394d3e11a60997b00eca48.zip
Catch exceptions while creating shared mounts
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/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/appinfo/application.php b/apps/files_sharing/appinfo/application.php
index 64c7517456d..311250ce195 100644
--- a/apps/files_sharing/appinfo/application.php
+++ b/apps/files_sharing/appinfo/application.php
@@ -111,7 +111,8 @@ class Application extends App {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new MountProvider(
- $server->getConfig()
+ $server->getConfig(),
+ $server->getLogger()
);
});
diff --git a/apps/files_sharing/lib/mountprovider.php b/apps/files_sharing/lib/mountprovider.php
index 4a60e44bb26..d1d54a21ab3 100644
--- a/apps/files_sharing/lib/mountprovider.php
+++ b/apps/files_sharing/lib/mountprovider.php
@@ -27,6 +27,7 @@ use OC\User\NoUserException;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
+use OCP\ILogger;
use OCP\IUser;
class MountProvider implements IMountProvider {
@@ -36,10 +37,17 @@ class MountProvider implements IMountProvider {
protected $config;
/**
+ * @var ILogger
+ */
+ protected $logger;
+
+ /**
* @param \OCP\IConfig $config
+ * @param ILogger $logger
*/
- public function __construct(IConfig $config) {
+ public function __construct(IConfig $config, ILogger $logger) {
$this->config = $config;
+ $this->logger = $logger;
}
@@ -57,15 +65,20 @@ class MountProvider implements IMountProvider {
});
$shares = array_map(function ($share) use ($user, $storageFactory) {
- return new SharedMount(
- '\OC\Files\Storage\Shared',
- '/' . $user->getUID() . '/' . $share['file_target'],
- array(
- 'share' => $share,
- 'user' => $user->getUID()
- ),
- $storageFactory
- );
+ try {
+ return new SharedMount(
+ '\OC\Files\Storage\Shared',
+ '/' . $user->getUID() . '/' . $share['file_target'],
+ array(
+ 'share' => $share,
+ 'user' => $user->getUID()
+ ),
+ $storageFactory
+ );
+ } catch (\Exception $e) {
+ $this->logger->logException($e);
+ $this->logger->error('Error while trying to create shared mount');
+ }
}, $shares);
// array_filter removes the null values from the array
return array_filter($shares);