Skip to content

Commit

Permalink
use resourceid wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Feb 16, 2022
1 parent 38ba9f6 commit c8b1d89
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/storage/utils/decomposedfs/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/cs3org/reva/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/pkg/storage/utils/decomposedfs/xattrs"
"github.com/cs3org/reva/pkg/utils"
"github.com/cs3org/reva/pkg/utils/resourceid"
"github.com/google/uuid"
)

Expand Down Expand Up @@ -409,10 +410,12 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up
hasDescription = true
}
if image, ok := space.Opaque.Map["image"]; ok {
metadata[xattrs.SpaceImageAttr] = string(image.Value)
imageID := resourceid.OwnCloudResourceIDUnwrap(string(image.Value))
metadata[xattrs.SpaceImageAttr] = imageID.OpaqueId
}
if readme, ok := space.Opaque.Map["readme"]; ok {
metadata[xattrs.SpaceReadmeAttr] = string(readme.Value)
readmeID := resourceid.OwnCloudResourceIDUnwrap(string(readme.Value))
metadata[xattrs.SpaceReadmeAttr] = readmeID.OpaqueId
}
}

Expand Down Expand Up @@ -706,7 +709,7 @@ func (fs *Decomposedfs) storageSpaceFromNode(ctx context.Context, n *node.Node,
if ok {
space.Opaque.Map["image"] = &types.OpaqueEntry{
Decoder: "plain",
Value: []byte(spaceImage),
Value: []byte(resourceid.OwnCloudResourceIDWrap(&provider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: spaceImage})),
}
}
spaceDescription, ok := spaceAttributes[xattrs.SpaceDescriptionAttr]
Expand All @@ -720,7 +723,7 @@ func (fs *Decomposedfs) storageSpaceFromNode(ctx context.Context, n *node.Node,
if ok {
space.Opaque.Map["readme"] = &types.OpaqueEntry{
Decoder: "plain",
Value: []byte(spaceReadme),
Value: []byte(resourceid.OwnCloudResourceIDWrap(&provider.ResourceId{StorageId: space.Root.StorageId, OpaqueId: spaceReadme})),
}
}
return space, nil
Expand Down

0 comments on commit c8b1d89

Please sign in to comment.