summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/MountProvider.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-01-19 15:02:46 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-03-17 00:07:03 -0600
commit377fdf3860e317b68392c678fa25e081251baecc (patch)
tree3ca0e680377018a10df0dbf4999dd27d679e3c43 /apps/files_sharing/lib/MountProvider.php
parent39afcbd49feb4ba333746762fe7c9d4701db9860 (diff)
downloadnextcloud-server-377fdf3860e317b68392c678fa25e081251baecc.tar.gz
nextcloud-server-377fdf3860e317b68392c678fa25e081251baecc.zip
Skip null groups in group manager (#26871) (#26956)
* Skip null groups in group manager (#26871) * Skip null groups in group manager * Also skip null groups in group manager's search function * Add more group null checks in sharing code * Add unit tests for null group safety in group manager * Add unit tests for sharing code null group checks * Added tests for null groups handling in sharing code * Ignore moveShare optional repair in mount provider In some cases, data is inconsistent in the oc_share table due to legacy data. The mount provider might attempt to make it consistent but if the target group does not exist any more it cannot work. In such case we simply ignore the exception as it is not critical. Keeping the exception would break user accounts as they would be unable to use their filesystem. * Adjust null group handing + tests * Fix new group manager tests Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_sharing/lib/MountProvider.php')
-rw-r--r--apps/files_sharing/lib/MountProvider.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php
index 5c5d57057b2..93f85a888b0 100644
--- a/apps/files_sharing/lib/MountProvider.php
+++ b/apps/files_sharing/lib/MountProvider.php
@@ -170,7 +170,23 @@ class MountProvider implements IMountProvider {
if ($share->getTarget() !== $superShare->getTarget()) {
// adjust target, for database consistency
$share->setTarget($superShare->getTarget());
- $this->shareManager->moveShare($share, $user->getUID());
+ try {
+ $this->shareManager->moveShare($share, $user->getUID());
+ } catch (\InvalidArgumentException $e) {
+ // ignore as it is not important and we don't want to
+ // block FS setup
+
+ // the subsequent code anyway only uses the target of the
+ // super share
+
+ // such issue can usually happen when dealing with
+ // null groups which usually appear with group backend
+ // caching inconsistencies
+ \OC::$server->getLogger()->debug(
+ 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(),
+ ['app' => 'files_sharing']
+ );
+ }
}
if (!is_null($share->getNodeCacheEntry())) {
$superShare->setNodeCacheEntry($share->getNodeCacheEntry());