Skip to content

Commit 616e85e

Browse files
committed
fix(encryption): init filesystem before unshare hook
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
1 parent 6d7e342 commit 616e85e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/private/Encryption/HookManager.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ public static function postShared($params): void {
2222
public static function postUnshared($params): void {
2323
// In case the unsharing happens in a background job, we don't have
2424
// a session and we load instead the user from the UserManager
25+
if (Filesystem::getView() === null) {
26+
$uidOwner = $params['uidOwner'] ?? '';
27+
if (is_string($uidOwner) && $uidOwner !== '') {
28+
$user = \OC::$server->getUserManager()->get($uidOwner);
29+
if ($user !== null) {
30+
$setupManager = \OC::$server->get(SetupManager::class);
31+
if (!$setupManager->isSetupComplete($user)) {
32+
$setupManager->setupForUser($user);
33+
}
34+
}
35+
}
36+
}
37+
if (Filesystem::getView() === null) {
38+
return;
39+
}
2540
$path = Filesystem::getPath($params['fileSource']);
2641
$owner = Filesystem::getOwner($path);
2742
self::getUpdate($owner)->postUnshared($params);

0 commit comments

Comments
 (0)