Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shareid on PROPFINDs #3201

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-shareid-on-propfind.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix shareid on PROPFIND

shareid was still not working properly. We need to parse it from the path

https://github.com/cs3org/reva/pull/3201
12 changes: 7 additions & 5 deletions internal/http/services/owncloud/ocdav/propfind/propfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,9 +986,11 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
prop.Escaped("oc:spaceid", md.Id.SpaceId),
)

if md.Id.GetStorageId() == utils.ShareStorageProviderID {
propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:shareid", md.Id.GetOpaqueId()))
}
}

// we need to add the shareid if possible - the only way to extract it here is to parse it from the path
if ref, err := storagespace.ParseReference(strings.TrimPrefix(md.Path, "/")); err == nil && ref.GetResourceId().GetSpaceId() == utils.ShareStorageSpaceID {
propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:shareid", ref.GetResourceId().GetOpaqueId()))
}

if md.Name != "" {
Expand Down Expand Up @@ -1322,8 +1324,8 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
case "name":
propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:name", md.Name))
case "shareid":
if md.Id.GetStorageId() == utils.ShareStorageProviderID {
propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:shareid", md.Id.GetOpaqueId()))
if ref, err := storagespace.ParseReference(strings.TrimPrefix(md.Path, "/")); err == nil && ref.GetResourceId().GetSpaceId() == utils.ShareStorageSpaceID {
propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:shareid", ref.GetResourceId().GetOpaqueId()))
}
case "privatelink": // phoenix only
// <oc:privatelink>https://phoenix.owncloud.com/f/9</oc:privatelink>
Expand Down