Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion apps/files_sharing/appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public function __construct(array $urlParams = array()) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new MountProvider(
$server->getConfig()
$server->getConfig(),
$server->getLogger()
);
});

Expand Down
33 changes: 23 additions & 10 deletions apps/files_sharing/lib/mountprovider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;

class MountProvider implements IMountProvider {
Expand All @@ -35,11 +36,18 @@ 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;
}


Expand All @@ -57,15 +65,20 @@ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
});
$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);
Expand Down