Skip to content

Commit

Permalink
add space metadata to ocs shares
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Jun 12, 2023
1 parent 7d94bc3 commit 6a24e08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/add-space-metadata-to-ocs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add space metadata to ocs shares list

We needed to add the space ID and the space alias of the orgininal space to the share metadata when we are listing shares. This is needed to directly navigate to the orgiginating space location.

https://github.com/cs3org/reva/pull/3966
6 changes: 5 additions & 1 deletion internal/http/services/owncloud/ocs/conversions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ type ShareData struct {
// The type of the object being shared. This can be one of 'file' or 'folder'.
ItemType string `json:"item_type" xml:"item_type"`
// The RFC2045-compliant mimetype of the file.
MimeType string `json:"mimetype" xml:"mimetype"`
MimeType string `json:"mimetype" xml:"mimetype"`
SpaceID string `json:"space_id" xml:"space_id"`
// The space alias of the original file location
SpaceAlias string `json:"space_alias" xml:"space_alias"`
// The space ID of the original file location
StorageID string `json:"storage_id" xml:"storage_id"`
Storage uint64 `json:"storage" xml:"storage"`
// The unique node id of the item being shared.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,11 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf
if s.UIDOwner == "" && owner != nil {
s.UIDOwner = owner.GetOpaqueId()
}

if info.GetSpace().GetId() != nil {
s.SpaceID = storagespace.FormatResourceID(*info.GetSpace().GetRoot())
}
s.SpaceAlias = utils.ReadPlainFromOpaque(info.GetSpace().GetOpaque(), "spaceAlias")
}

// mustGetIdentifiers always returns a struct with identifiers, if the user or group could not be found they will all be empty
Expand Down

0 comments on commit 6a24e08

Please sign in to comment.