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 space metadata to ocs shares #3966

Merged
merged 1 commit into from
Jun 12, 2023
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/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 original space to the share metadata when we are listing shares. This is needed to directly navigate to the originating space location.

https://github.com/cs3org/reva/pull/3966
10 changes: 7 additions & 3 deletions internal/http/services/owncloud/ocs/conversions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ 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"`
StorageID string `json:"storage_id" xml:"storage_id"`
Storage uint64 `json:"storage" xml:"storage"`
MimeType string `json:"mimetype" xml:"mimetype"`
// The space ID of the original file location
SpaceID string `json:"space_id" xml:"space_id"`
// The space alias of the original file location
SpaceAlias string `json:"space_alias" xml:"space_alias"`
StorageID string `json:"storage_id" xml:"storage_id"`
Storage uint64 `json:"storage" xml:"storage"`
// The unique node id of the item being shared.
ItemSource string `json:"item_source" xml:"item_source"`
// The unique node id of the item being shared. For legacy reasons item_source and file_source attributes have the same value.
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().GetRoot() != 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