Skip to content

fix(dav): return a list from the share-types property - #65813

Open
MarioPym wants to merge 1 commit into
nextcloud:masterfrom
MarioPym:fix/share-types-property-list
Open

MarioPym wants to merge 1 commit into
nextcloud:masterfrom
MarioPym:fix/share-types-property-list

Conversation

@MarioPym

Copy link
Copy Markdown

Summary

SharesPlugin builds the oc:share-types property with array_unique(), which keeps the original keys. When a node has more than one share of the same type (e.g. two user shares and a link), ShareTypeList::getShareTypes() returns [0 => 0, 2 => 3] instead of [0, 3].

The XML output is the same, because the serializer only iterates the values. But the property is not a list anymore: any code that reads getShareTypes() and encodes it as JSON gets an object ({"0":0,"2":3}) instead of an array ([0,3]).

This wraps the result in array_values() and documents ShareTypeList as list<int>, so psalm can catch it in the future.

How to test

  1. Share a folder with two users and create a public link for it.
  2. Check getShareTypes() of the oc:share-types property for that folder (the XML response does not show the keys):
    • Before: [0 => 0, 2 => 3] (as JSON: {"0":0,"2":3}).
    • After: [0, 3] (as JSON: [0,3]).
    • The XML response (<oc:share-types>) does not change.

Unit test: testGetPropertiesReturnsListWithRepeatedShareTypes in apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php. The existing data provider never repeats a share type, so this case was not covered.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
@MarioPym
MarioPym requested a review from a team as a code owner October 23, 2026 16:33
@MarioPym
MarioPym requested review from Altahrim, come-nc, provokateurin and salmart-dev and removed request for a team October 23, 2026 16:33

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant