diff --git a/changelog/unreleased/add-space-name-attribute.md b/changelog/unreleased/add-space-name-attribute.md new file mode 100644 index 00000000000..ae479b94a83 --- /dev/null +++ b/changelog/unreleased/add-space-name-attribute.md @@ -0,0 +1,5 @@ +Enhancement: Return space name during list storage spaces + +In the decomposedfs we return now the space name in the response which is stored in the extended attributes. + +https://github.com/cs3org/reva/issues/2090 \ No newline at end of file diff --git a/pkg/storage/utils/decomposedfs/spaces.go b/pkg/storage/utils/decomposedfs/spaces.go index c98082347bd..b312ea6854f 100644 --- a/pkg/storage/utils/decomposedfs/spaces.go +++ b/pkg/storage/utils/decomposedfs/spaces.go @@ -217,14 +217,21 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide // Mtime is set either as node.tmtime or as fi.mtime below } - if space.SpaceType == "share" { + switch space.SpaceType { + case "share": if utils.UserEqual(u.Id, owner) { // do not list shares as spaces for the owner continue } - } else { - space.Name = "root" // do not expose the id as name, this is the root of a space - // TODO read from extended attribute for project / group spaces + case "project": + sname, err := xattr.Get(n.InternalPath(), xattrs.SpaceNameAttr) + if err != nil { + appctx.GetLogger(ctx).Error().Err(err).Interface("node", n).Msg("could not read space name, attribute not found") + continue + } + space.Name = string(sname) + default: + space.Name = "root" } // filter out spaces user cannot access (currently based on stat permission)