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 6184dc9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
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 6184dc9

Please sign in to comment.