fix(encryption): init filesystem before unshare hook

Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
This commit is contained in:
Hoang Pham 2026-01-05 17:26:19 +07:00
parent 6d7e3420ba
commit 616e85e97b

View file

@ -22,6 +22,21 @@ class HookManager {
public static function postUnshared($params): void {
// In case the unsharing happens in a background job, we don't have
// a session and we load instead the user from the UserManager
if (Filesystem::getView() === null) {
$uidOwner = $params['uidOwner'] ?? '';
if (is_string($uidOwner) && $uidOwner !== '') {
$user = \OC::$server->getUserManager()->get($uidOwner);
if ($user !== null) {
$setupManager = \OC::$server->get(SetupManager::class);
if (!$setupManager->isSetupComplete($user)) {
$setupManager->setupForUser($user);
}
}
}
}
if (Filesystem::getView() === null) {
return;
}
$path = Filesystem::getPath($params['fileSource']);
$owner = Filesystem::getOwner($path);
self::getUpdate($owner)->postUnshared($params);