Skip to content

Commit b93a830

Browse files
Merge fa938cd into 447d523
2 parents 447d523 + fa938cd commit b93a830

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/FilesHooks.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ protected function shareWithTeam(string $shareWith, int $fileSource, string $ite
816816
* @throws \OCP\Files\NotFoundException
817817
*/
818818
public function unShare(IShare $share) {
819-
if (in_array($share->getNodeType(), ['file', 'folder'], true)) {
819+
if (in_array($share->getNodeType(), ['file', 'folder'], true) && !$this->isDeletedNode($share->getShareOwner(), $share->getNodeId())) {
820820
if ($share->getShareType() === IShare::TYPE_USER) {
821821
$this->unshareFromUser($share);
822822
} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
@@ -1397,4 +1397,14 @@ private function getUnrelatedUsers(int $fileId, array $cachedMounts): array {
13971397

13981398
return $filteredUsers;
13991399
}
1400+
1401+
private function isDeletedNode(string $owner, int $nodeId): bool {
1402+
try {
1403+
$userFolder = $this->rootFolder->getUserFolder($owner);
1404+
$node = $userFolder->getFirstNodeById($nodeId);
1405+
return $node === null;
1406+
} catch (NotFoundException $e) {
1407+
return true;
1408+
}
1409+
}
14001410
}

0 commit comments

Comments
 (0)