Skip to content

Commit 82fb7cb

Browse files
authored
Temporary workaround for removing favorited folders (#5120)
1 parent b50845e commit 82fb7cb

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: allow folders to be un-favorited
2+
3+
Currently, removing a folder from your favorites is broken, if you are the only one who has favorited it.
4+
This is because the UnsetAttr call to EOS over gRPC is failing. As a temporary workaround, we now always set it to empty.
5+
6+
https://github.com/cs3org/reva/pull/5120

internal/grpc/services/storageprovider/storageprovider.go

+2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ func (s *service) SetArbitraryMetadata(ctx context.Context, req *provider.SetArb
242242
}
243243

244244
func (s *service) UnsetArbitraryMetadata(ctx context.Context, req *provider.UnsetArbitraryMetadataRequest) (*provider.UnsetArbitraryMetadataResponse, error) {
245+
log := appctx.GetLogger(ctx)
245246
newRef, err := s.unwrap(ctx, req.Ref)
246247
if err != nil {
247248
err := errors.Wrap(err, "storageprovidersvc: error unwrapping path")
@@ -258,6 +259,7 @@ func (s *service) UnsetArbitraryMetadata(ctx context.Context, req *provider.Unse
258259
case errtypes.PermissionDenied:
259260
st = status.NewPermissionDenied(ctx, err, "permission denied")
260261
default:
262+
log.Error().Err(err).Str("ref", req.Ref.String()).Any("keys", req.ArbitraryMetadataKeys).Msg("error unsetting arbitrary metadata")
261263
st = status.NewInternal(ctx, err, "error unsetting arbitrary metadata: "+req.Ref.String())
262264
}
263265
return &provider.UnsetArbitraryMetadataResponse{

pkg/eosclient/eosgrpc/eosgrpc.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,18 @@ func (c *Client) handleFavAttr(ctx context.Context, auth eosclient.Authorization
604604
favs.DeleteEntry(acl.TypeUser, u.Id.OpaqueId)
605605
}
606606
attr.Val = favs.Serialize()
607-
if attr.Val == "" {
608-
return c.unsetEOSAttr(ctx, auth, attr, recursive, path, "", true)
609-
} else {
610-
return c.setEOSAttr(ctx, auth, attr, false, recursive, path, "")
611-
}
607+
608+
// If the value is empty, we should actually unset it
609+
// However, for some reason, for folders, we currently get
610+
// permission denied from EOS when removing the attr.
611+
// So, as a temporary workaround, we now set to empty
612+
// See CERNBOX-3793
613+
614+
// if attr.Val == "" {
615+
// return c.unsetEOSAttr(ctx, auth, attr, recursive, path, "", true)
616+
// } else {
617+
return c.setEOSAttr(ctx, auth, attr, false, recursive, path, "")
618+
// }
612619
}
613620

614621
// UnsetAttr unsets an extended attribute on a path.

0 commit comments

Comments
 (0)