From 32c6304c5a6122a4f4545a75a7771e8cc859aa4d Mon Sep 17 00:00:00 2001 From: Jesse Geens Date: Wed, 13 Nov 2024 10:29:07 +0100 Subject: [PATCH] Fixed broken removal of favourites --- changelog/unreleased/fix-fav-grpc.md | 5 +++++ pkg/eosclient/eosgrpc/eosgrpc.go | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 changelog/unreleased/fix-fav-grpc.md diff --git a/changelog/unreleased/fix-fav-grpc.md b/changelog/unreleased/fix-fav-grpc.md new file mode 100644 index 0000000000..e5d5645b35 --- /dev/null +++ b/changelog/unreleased/fix-fav-grpc.md @@ -0,0 +1,5 @@ +Bugfix: make removal of favourites work + +Currently, removing a folder from your favourites is broken, because the handleFavAttr method is only called in SetAttr, not in UnsetAttr. This change fixes this. + +https://github.com/cs3org/reva/pull/4930 \ No newline at end of file diff --git a/pkg/eosclient/eosgrpc/eosgrpc.go b/pkg/eosclient/eosgrpc/eosgrpc.go index 22f46e590c..f5f6bdcfac 100644 --- a/pkg/eosclient/eosgrpc/eosgrpc.go +++ b/pkg/eosclient/eosgrpc/eosgrpc.go @@ -602,6 +602,15 @@ func (c *Client) UnsetAttr(ctx context.Context, auth eosclient.Authorization, at log := appctx.GetLogger(ctx) log.Info().Str("func", "UnsetAttr").Str("uid,gid", auth.Role.UID+","+auth.Role.GID).Str("path", path).Msg("") + // Favorites need to be stored per user so handle these separately + if attr.Type == eosclient.UserAttr && attr.Key == favoritesKey { + info, err := c.GetFileInfoByPath(ctx, auth, path) + if err != nil { + return err + } + return c.handleFavAttr(ctx, auth, attr, recursive, path, info, false) + } + // Initialize the common fields of the NSReq rq, err := c.initNSRequest(ctx, auth, app) if err != nil {