Skip to content

fix(files_sharing): stop ignoring shares without a usergroup entry when filtering by path#57930

Merged
AndyScherzinger merged 1 commit intomasterfrom
artonge/fix/share_resolution
Feb 4, 2026
Merged

fix(files_sharing): stop ignoring shares without a usergroup entry when filtering by path#57930
AndyScherzinger merged 1 commit intomasterfrom
artonge/fix/share_resolution

Conversation

@artonge
Copy link
Contributor

@artonge artonge commented Jan 30, 2026

Previously, this was preventing users without a specific USERGROUP entry to see GROUP shares.

The path filtering is now done at resolution time. This is less efficient, but keeps the old behavior. (crossed out from Salvatore)

I think we should probably update the other share providers to follow the same logic.

@artonge artonge requested a review from a team as a code owner January 30, 2026 19:54
@artonge artonge requested review from ArtificialOwl, CarlSchwan, come-nc and icewind1991 and removed request for a team January 30, 2026 19:54
@artonge artonge self-assigned this Jan 30, 2026
@artonge artonge added bug 3. to review Waiting for reviews feature: sharing php Pull requests that update Php code labels Jan 30, 2026
@artonge artonge added this to the Nextcloud 33 milestone Jan 30, 2026
@salmart-dev salmart-dev self-assigned this Feb 2, 2026
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won’t that cause an issue with non-accepted group shares?
Or if the user left the share?

salmart-dev

This comment was marked as outdated.

@salmart-dev

This comment was marked as outdated.

@salmart-dev

This comment was marked as outdated.

@salmart-dev salmart-dev dismissed their stale review February 2, 2026 13:52

Moving the path filtering to the resolve step would remove the filtering on the "parent" share, having the result of returning all shares received by a user where the only resolved ones are the ones where the path condition matches. This is not what we want.

@salmart-dev salmart-dev force-pushed the artonge/fix/share_resolution branch from f4a8d15 to 073d980 Compare February 2, 2026 14:24
@salmart-dev
Copy link
Contributor

Edited the PR to avoid filtering by path only during the resolution step, as that would cause only the shares with a specific path to be resolved + would return shares unrelated to the path, since the first step would not filter by path any longer.

The new changes:

  • keep the join query as a way to filter by path (customised paths are only present in the usegroup row, while the unchanged path can be present both in the usergroup or in the group rows, also the usergroup row could be missing but we still want the share)
  • moved where clauses that belong to the to the join into the join condition instead of where
  • changed the path query to target either file_target in s or in sc

This fixes the case where a share's permission get reduced because some usergroup rows may be missing for a specific share/user and others may be present resulting in incorrect permissions.

@salmart-dev salmart-dev requested a review from come-nc February 2, 2026 14:31
@provokateurin
Copy link
Member

In all cases on master I am able to share and access the share and its contents

Try the same on stable33, there seem to be some things working on master that aren't working on stable33 for some reason.

@salmart-dev salmart-dev changed the title fix(files_sharing): Move path filtering to group share resolution fix(files_sharing): stop ignoring shares without a usergroup entry when filtering by path Feb 2, 2026
@salmart-dev
Copy link
Contributor

In all cases on master I am able to share and access the share and its contents

Try the same on stable33, there seem to be some things working on master that aren't working on stable33 for some reason.

Do you have more context? I can reproduce this issue also on stable33

@salmart-dev
Copy link
Contributor

/backport to stable33

Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot see any problem anymore, does not mean there are none 🙈

@salmart-dev
Copy link
Contributor

I will open a separate PR to apply the same changes to the deck provider, which also seems to have a wrong join condition

@salmart-dev
Copy link
Contributor

salmart-dev commented Feb 4, 2026

Notes on the additional changes: we agreed with Louis and Kate to replace the _% LIKE query with /_% and remove the trailing slash from the path instead, to prevent confusion. I also adjusted the formatting.

Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor Author

@artonge artonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salmart-dev I can't approve, feel free to do so for me 👍

@salmart-dev salmart-dev force-pushed the artonge/fix/share_resolution branch from 5e67c2f to 07b25ab Compare February 4, 2026 15:52
Previously, this was preventing users without a specific USERGROUP entry to see GROUP shares.

Signed-off-by: Louis Chmn <louis@chmn.me>
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
@salmart-dev salmart-dev force-pushed the artonge/fix/share_resolution branch from 07b25ab to 79c07d3 Compare February 4, 2026 15:53
@salmart-dev salmart-dev added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Feb 4, 2026
@AndyScherzinger AndyScherzinger merged commit 5f54a06 into master Feb 4, 2026
224 of 235 checks passed
@AndyScherzinger AndyScherzinger deleted the artonge/fix/share_resolution branch February 4, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish bug feature: sharing php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants