Skip to content

Conversation

@kesselb
Copy link
Contributor

@kesselb kesselb commented Jan 20, 2026

Summary

This one is a bit tricky and caused me some headaches 🤯

Steps to reproduce:

  • Alice@A shares a folder with Bob@A
  • Bob@A re-shares that folder with Jane@B
  • An error toast is shown

The ShareNotFound exception is thrown in FederatedShareProvider.getRemoteId when there is no record in federated_shares. That seems like a valid state, since Alice and Bob are both on instance A.

The check in FederatedShareProvider.update only verifies that alice != bob and therefore calls FederatedShareProvider.sendPermissionUpdate. However, because Alice and Bob are on the same instance, there is no need to send a permission update to a remote server.

This change adjusts the condition accordingly, similar to what was done in oC a few years ago.

Given that this code path has barely been touched in recent years, it was surprising to see this error now. My assumption is that updating federated shares used to be a relatively uncommon operation, and since it usually worked despite that error, there were no reports.

Since #51250, we now call create followed by update when creating a share, which makes this case much more likely to occur and exposes the issue more frequently.

How to test:

Case 1:

  • Alice@A shares a folder with Bob@A
  • Bob@A re-shares that folder with Jane@B
  • See the success toast

Case 2:

  • Bob@A unshares the folder with Jane@B
  • See the success toast

(Note: Unsharing works, but item is not removed from the share list in the view currently. That's unrelated to this pr.)

Case 3:

  • Alice@A unshares the folder with Jane@B
  • See the success toast

(Note: Unsharing works, but item is not removed from the share list in the view currently. That's unrelated to this pr.)

Tests:

I agree the tests are not great due to the heavy mocking around the query builder and related components. Still, I thought it was important to have at least some validation that the correct code path is executed.

The existing FederatedShareProviderTest does not write anything into the federated_shares table, so this code path is never called there.

Once the app is migrated to our usual QBMapper, the tests should become much cleaner and easier to maintain.

TODO

  • ...

Checklist

@kesselb kesselb force-pushed the bug/noid/avoid-error-when-updating-share branch from 1977e86 to bbf2e7e Compare January 20, 2026 18:10
@kesselb kesselb force-pushed the bug/noid/avoid-error-when-updating-share branch 2 times, most recently from 5d52a0c to 823c8d3 Compare January 29, 2026 23:13
@kesselb kesselb changed the title wip fix(sharing): do not notify remote if owner and sharee are local users Jan 29, 2026
@kesselb kesselb force-pushed the bug/noid/avoid-error-when-updating-share branch 2 times, most recently from 1712e6d to 75a7f12 Compare January 30, 2026 14:43
@kesselb kesselb self-assigned this Jan 30, 2026
@kesselb kesselb added bug 2. developing Work in progress labels Jan 30, 2026
If both the owner and the sharee are local users, no remote notification is required.
If either the owner or the sharee is not a local user, the change must be propagated.

Based on owncloud/core#37534

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Co-authored-by: Victor Dubiniuk <victor.dubiniuk@gmail.com>
@kesselb kesselb force-pushed the bug/noid/avoid-error-when-updating-share branch from 75a7f12 to b735ee5 Compare February 4, 2026 10:53
@kesselb kesselb added feature: federation 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 4, 2026
@kesselb kesselb marked this pull request as ready for review February 4, 2026 11:00
@kesselb kesselb requested a review from a team as a code owner February 4, 2026 11:00
@kesselb kesselb requested review from ArtificialOwl, come-nc, leftybournes and sorbaugh and removed request for a team February 4, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Share not found error when creating a federated share from a share

1 participant