Repository navigation
fix(sharing): Reindex sharing group lists when a group is deleted - #67684
Open
kukanggg89 wants to merge 1 commit into
Open
kukanggg89 wants to merge 1 commit into
kukanggg89 wants to merge 1 commit into
Conversation
array_diff() keeps the original array keys, so deleting any
group but the last one left shareapi_exclude_groups_list
stored as a JSON object ({"1": "b"}) instead of a list,
which the admin sharing settings pass on to the frontend
as a string[]. Re-index the list with array_values()
after removing the deleted group, and clean the deleted
group out of the other three sharing group lists too.
Lists the group was never in are left untouched.
Fixes nextcloud#67451
Signed-off-by: parel <farelalfarizi89@gmail.com>
Assisted-by: Muse:Muse Spark 1.3
kukanggg89
requested review from
Altahrim,
GhassenKefi,
icewind1991 and
vlotysh
and removed request for
a team
December 4, 2026 07:34
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deleting a group ran
shareapi_exclude_groups_listthrougharray_diff(), which keeps the original array keys. Removing any group but the last one left the stored value as a JSON object ({"1": "b"}) instead of a list, and the admin sharing settings hand that value to the frontend as astring[], so the excluded-groups selection could show wrong values.Share20\Manager::groupDeleted()now removes the deleted group through a shared helper,removeGroupFromSharingGroupList(), which re-indexes the list witharray_values()before writing it back. The helper also cleans the deleted group out of the other three sharing group lists (shareapi_allow_links_exclude_groups,shareapi_enforce_links_password_excluded_groups,shareapi_only_share_with_group_members_exclude_group_list), since those kept the ids of deleted groups too. A list the group was never in is left alone, and an empty or invalid stored value is skipped.tests/lib/Share20/ManagerTest.phpgets three new tests: deleting groupastores["b"]for the exclude list,["c"]for the link-exclude list, and[]for the group-members-only list while the password-exclude list is untouched; deleting a group that is in no list writes nothing; and an invalid stored value writes nothing.Verification: the new tests were not run locally, there is no PHP on the machine this change was made on, so CI has to run them. The re-indexing was checked by reading the code path, not by running the suite.
TODO
No open TODOs.
Checklist
3. to review, feature component) (n/a: maintainers set labels)stable32) (n/a: maintainers set the milestone)AI (if applicable)
Drafted with help from Claude. I reviewed and revised every change myself before opening this PR.