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

Add name to propfind response #3158

Merged
merged 1 commit into from
Aug 18, 2022
Merged
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
6 changes: 6 additions & 0 deletions changelog/unreleased/add-name-to-propfindresponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Add name to the propfind response

Previously the file- or foldername had to be extracted from the href. This is not nice and
doesn't work for alias links.

https://github.com/cs3org/reva/pull/3158
6 changes: 6 additions & 0 deletions internal/http/services/owncloud/ocdav/propfind/propfind.go
Original file line number Diff line number Diff line change
@@ -987,6 +987,10 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
)
}

if md.Name != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a fallback to file.Base(md.Path)? I don't think every storage driver returns name, yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

tracking as a dedicated issue in #3161

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will result in Names like "1284d238-aa92-42ce-bdc4-0b0000009157$534bb038-6f9d-4093-946f-133be61fa4e7!1887651e-4f0b-4d7b-8057-50a6f3945522" on a PROPFIND for a single resource. That was the reason we needed this field anyways.

Imho if the driver doesn't support names the prop is empty

propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:name", md.Name))
}

if md.Etag != "" {
// etags must be enclosed in double quotes and cannot contain them.
// See https://tools.ietf.org/html/rfc7232#section-2.3 for details
@@ -1311,6 +1315,8 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
propstatNotFound.Prop = append(propstatNotFound.Prop, prop.NotFound("oc:signature-auth"))
}
}
case "name":
propstatOK.Prop = append(propstatOK.Prop, prop.Raw("oc:name", md.Name))
case "privatelink": // phoenix only
// <oc:privatelink>https://phoenix.owncloud.com/f/9</oc:privatelink>
fallthrough
1 change: 1 addition & 0 deletions pkg/storage/utils/decomposedfs/node/node.go
Original file line number Diff line number Diff line change
@@ -643,6 +643,7 @@ func (n *Node) AsResourceInfo(ctx context.Context, rp *provider.ResourcePermissi
PermissionSet: rp,
Owner: n.Owner(),
ParentId: parentID,
Name: n.Name,
}

if nodeType == provider.ResourceType_RESOURCE_TYPE_CONTAINER {