Skip to content

Conversation

@danxuliu
Copy link
Member

Fixes a regression introduced in #2103

Before #2103 unShareSelf explicitly handled group shares and, for other types, delegated to unShare, which explicitly checkes user, group and link shares. In practice in that case unShare only called unshareFromUser for user shares, as group shares were already handled and link shares can not be deleted from self.

Since #2103 unShareSelf still explicitly handles group shares, but for other types directly calls unshareFromUser. However, there are other types that can be deleted from self (for example, circle or room shares), so they were wrongly handled as user shares.

The result was not a wrong entry in the activity, but an exception thrown in getUserRelativePath due to the path of the share not belonging to the user that removed it. The exception does not cause the request to fail due to nextcloud/server#54419 for Nextcloud 32 and later, and due to #2217 for Nextcloud 31.0.11 and later, but it was added nevertheless to the Nextcloud log.

This fix ensures that now only user shares are hadled as user shares, but it does not handle other types of shares, so no entry is added in the activity for them (but that was already the case before).

How to test

  • As user A, create a team
  • Add user B
  • Share a file with the team
  • As user B, open the Files app
  • Delete the shared file

Result with this pull request

No error is printed in Nextcloud log

Result without this pull request

Error while sending ' . leave share . ' event with message /XXX/files/debugger.css is not a path for YYY (where XXX and YYY are the user ids) is added to Nextcloud log

@danxuliu
Copy link
Member Author

/backport to stable32

@danxuliu
Copy link
Member Author

/backport to stable31

@danxuliu danxuliu marked this pull request as draft January 19, 2026 12:14
@cypress
Copy link

cypress bot commented Jan 19, 2026

Activity    Run #3171

Run Properties:  status check passed Passed #3171  •  git commit 004ed593e3: fix: Fix handling of deleting share from self
Project Activity
Branch Review fix-handling-of-deleting-share-from-self
Run status status check passed Passed #3171
Run duration 02m 22s
Commit git commit 004ed593e3: fix: Fix handling of deleting share from self
Committer Daniel Calviño Sánchez
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 9
View all changes introduced in this branch ↗︎

@danxuliu danxuliu force-pushed the fix-handling-of-deleting-share-from-self branch from 5fe098b to 3c6b4dd Compare January 19, 2026 12:54
If a share is deleted from self and it is not a group share it was
handled as a user share. However, other types of shares can be deleted
from self (for example, circle or room shares), so user shares need to
be explicitly checked.

Note that as those other share types are not explicitly handled no entry
is added to the activity for them, but that was already the case before
(this change just prevents an exception to be thrown).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu force-pushed the fix-handling-of-deleting-share-from-self branch from 3c6b4dd to 80afa22 Compare January 19, 2026 13:33
@danxuliu danxuliu marked this pull request as ready for review January 19, 2026 13:45
@danxuliu
Copy link
Member Author

psalm intermittently (which is strange) fails locally for me with that error on master, and in any case it should be unrelated to the changes in this pull request.

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.

2 participants