Skip to content

Commit

Permalink
decomposedfs: add space if fieldmask is empty, * or has 'space'
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Jun 29, 2022
1 parent eb16043 commit 22fa8fe
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,25 @@ func (fs *Decomposedfs) GetMD(ctx context.Context, ref *provider.Reference, mdKe
return nil, errtypes.PermissionDenied(node.ID)
}

return node.AsResourceInfo(ctx, &rp, mdKeys, fieldMask, utils.IsRelativeReference(ref))
md, err := node.AsResourceInfo(ctx, &rp, mdKeys, fieldMask, utils.IsRelativeReference(ref))
if err != nil {
return nil, err
}

addSpace := len(fieldMask) == 0
for _, p := range fieldMask {
if p == "space" || p == "*" {
addSpace = true
break
}
}
if addSpace {
if md.Space, err = fs.storageSpaceFromNode(ctx, node, node.InternalPath(), false, false); err != nil {
return nil, err
}
}

return md, nil
}

// ListFolder returns a list of resources in the specified folder
Expand Down

0 comments on commit 22fa8fe

Please sign in to comment.