Browse Source

fix: Also cleanup orphaned shares user cannot be found anymore

Signed-off-by: Julius Härtl <jus@bitgrid.net>
tags/v28.0.0rc1
Julius Härtl 7 months ago
parent
commit
9677ca062e
No account linked to committer's email address
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      apps/files_sharing/lib/OrphanHelper.php

+ 6
- 1
apps/files_sharing/lib/OrphanHelper.php View File



namespace OCA\Files_Sharing; namespace OCA\Files_Sharing;


use OC\User\NoUserException;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\IDBConnection; use OCP\IDBConnection;
} }


public function isShareValid(string $owner, int $fileId): bool { public function isShareValid(string $owner, int $fileId): bool {
$userFolder = $this->rootFolder->getUserFolder($owner);
try {
$userFolder = $this->rootFolder->getUserFolder($owner);
} catch (NoUserException $e) {
return false;
}
$nodes = $userFolder->getById($fileId); $nodes = $userFolder->getById($fileId);
return count($nodes) > 0; return count($nodes) > 0;
} }

Loading…
Cancel
Save