proper error for search results outside user folder

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-03-24 14:33:35 +01:00
parent f842608c95
commit e8184eaaad
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 5 additions and 1 deletions

View File

@ -133,7 +133,11 @@ class File extends \OCP\Search\Result {
$userID = $userSession->getUser()->getUID();
self::$userFolderCache = \OC::$server->getUserFolder($userID);
}
return self::$userFolderCache->getRelativePath($path);
$relativePath = self::$userFolderCache->getRelativePath($path);
if ($relativePath === null) {
throw new \Exception("Search result not in user folder");
}
return $relativePath;
}
/**