Skip to content

Commit

Permalink
Remove favs attribute if no favourites are set
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Geens committed Dec 18, 2024
1 parent 2578d59 commit 58ac79c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-empty-fav-attr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: no empty favs attr

See issue #5016: we now unset the favs attr if no more favs are set

https://github.com/cs3org/reva/pull/5017
3 changes: 3 additions & 0 deletions pkg/eosclient/eosbinary/eosbinary.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@ func (c *Client) handleFavAttr(ctx context.Context, auth eosclient.Authorization
favs.DeleteEntry(acl.TypeUser, u.Id.OpaqueId)
}
attr.Val = favs.Serialize()
if attr.Val == "" {
return c.UnsetAttr(ctx, auth, attr, false, path, "")
}
return c.setEOSAttr(ctx, auth, attr, false, recursive, path, "")
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/eosclient/eosgrpc/eosgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ func (c *Client) handleFavAttr(ctx context.Context, auth eosclient.Authorization
favs.DeleteEntry(acl.TypeUser, u.Id.OpaqueId)
}
attr.Val = favs.Serialize()
if attr.Val == "" {
return c.UnsetAttr(ctx, auth, attr, false, path, "")
}
return c.setEOSAttr(ctx, auth, attr, false, recursive, path, "")
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/storage/utils/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func isComment(line string) bool {

// Serialize always serializes to short text form.
func (m *ACLs) Serialize() string {
if len(m.Entries) == 0 {
return ""
}

sysACL := []string{}
for _, e := range m.Entries {
sysACL = append(sysACL, e.CitrineSerialize())
Expand Down

0 comments on commit 58ac79c

Please sign in to comment.