Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-21 17:07:44 +0300
committerGitHub <noreply@github.com>2016-06-21 17:07:44 +0300
commitddd4f367c30114a22bab875408dbbc54388a6767 (patch)
tree4626446d08a540ba2d2dfb464130cc367e53f1f4 /apps
parentbf7a08f62dafd24932b93ffd213f4e40f151ced0 (diff)
parentfa9ba64552a43448d7394d3e11a60997b00eca48 (diff)
Merge pull request #25199 from owncloud/shared-mount-catch-9
[9.0] 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);