]> source.dussan.org Git - nextcloud-server.git/commitdiff
Handle unset owner in sharing 19936/head
authorJoas Schilling <coding@schilljs.com>
Fri, 13 Mar 2020 16:17:43 +0000 (17:17 +0100)
committerJoas Schilling <coding@schilljs.com>
Fri, 13 Mar 2020 16:17:43 +0000 (17:17 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Share20/Manager.php

index ca668e24e7f2c04db2c6e8540bba797ed7783ebc..3e22e7158ca43c522b4d2923d5b9d49acc719b9c 100644 (file)
@@ -302,7 +302,7 @@ class Manager implements IManager {
                $isFederatedShare = $share->getNode()->getStorage()->instanceOfStorage('\OCA\Files_Sharing\External\Storage');
                $permissions = 0;
                $mount = $share->getNode()->getMountPoint();
-               if (!$isFederatedShare && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {
+               if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {
                        // When it's a reshare use the parent share permissions as maximum
                        $userMountPointId = $mount->getStorageRootId();
                        $userMountPoints = $userFolder->getById($userMountPointId);
@@ -711,7 +711,11 @@ class Manager implements IManager {
                        }
                        $share->setShareOwner($parent->getOwner()->getUID());
                } else {
-                       $share->setShareOwner($share->getNode()->getOwner()->getUID());
+                       if ($share->getNode()->getOwner()) {
+                               $share->setShareOwner($share->getNode()->getOwner()->getUID());
+                       } else {
+                               $share->setShareOwner($share->getSharedBy());
+                       }
                }
 
                //Verify share type