Skip to content

Conversation

@hweihwang
Copy link
Contributor

@hweihwang hweihwang commented Jan 5, 2026

Summary

  • Initialize filesystem for share owner before resolving file path during unshare hook
  • Avoid null Filesystem view when running occ commands

@github-actions github-actions bot changed the title fix(encryption): init filesystem before unshare hook [stable31] fix(encryption): init filesystem before unshare hook Jan 5, 2026
@hweihwang hweihwang requested a review from blizzz January 19, 2026 09:08
@hweihwang hweihwang force-pushed the fix/ldap-show-remnants-encryption branch from 785f8e2 to 9428039 Compare January 19, 2026 09:10
@blizzz blizzz requested review from a team, Altahrim, artonge, come-nc and leftybournes and removed request for a team January 23, 2026 09:31
@blizzz blizzz added bug 3. to review Waiting for reviews labels Jan 23, 2026
@blizzz blizzz added this to the Nextcloud 31.0.14 milestone Jan 23, 2026
@blizzz
Copy link
Member

blizzz commented Jan 23, 2026

@hweihwang thanks for the fix 🙏 Please set reviewers, labels and milestone when opening the PR. Could you provide some context on why this is opened against stable31, not master?

@blizzz blizzz removed their request for review January 23, 2026 09:34
@hweihwang
Copy link
Contributor Author

Thanks @blizzz

Likely cause:

  • lib/private/Encryption/HookManager.php: postUnshared() calls Filesystem::getPath($params['fileSource']) before filesystem init
  • lib/private/Files/Filesystem.php: getPath() uses self::$defaultInstance->getPath() with no null guard
  • In occ context (no user session), filesystem not set up → $defaultInstance null → fatal

Seems only happen on <=31:

  • stable28–stable31 use legacy hook path (HookManager::postUnshared wired via connectHook)
    • Ref: stable31/lib/base.php → connectHook(Share::class, 'post_unshare', HookManager::class, 'postUnshared')
  • stable32+ replaces legacy hooks with event listener
    • Ref: stable32/lib/base.php → EncryptionEventListener::register()
    • Listener uses typed events + Update with setupManager->setupForUser() before work
    • No direct Filesystem::getPath() call in unshare handler; uses node object
    • Ref: stable32/lib/private/Encryption/EncryptionEventListener.php

Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@hweihwang hweihwang force-pushed the fix/ldap-show-remnants-encryption branch from 9428039 to 616e85e Compare January 26, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants