From 674deb10a090a9e58d2dc75c0c5aca2d51116a7d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 8 Mar 2026 21:20:22 -0700 Subject: [PATCH] fix: use errors.Is for filer_pb.ErrNotFound comparison in group loading Replace direct equality (==) with errors.Is() to correctly match wrapped errors, consistent with the rest of the codebase. --- weed/credential/filer_etc/filer_etc_group.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/credential/filer_etc/filer_etc_group.go b/weed/credential/filer_etc/filer_etc_group.go index 36cbeb19d..250930bc8 100644 --- a/weed/credential/filer_etc/filer_etc_group.go +++ b/weed/credential/filer_etc/filer_etc_group.go @@ -20,7 +20,7 @@ func (store *FilerEtcStore) loadGroupsFromMultiFile(ctx context.Context, s3cfg * dir := filer.IamConfigDirectory + "/" + IamGroupsDirectory entries, err := listEntries(ctx, client, dir) if err != nil { - if err == filer_pb.ErrNotFound { + if errors.Is(err, filer_pb.ErrNotFound) { return nil } return err @@ -109,7 +109,7 @@ func (store *FilerEtcStore) GetGroup(ctx context.Context, groupName string) (*ia err := store.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { data, err := filer.ReadInsideFiler(ctx, client, filer.IamConfigDirectory+"/"+IamGroupsDirectory, groupName+".json") if err != nil { - if err == filer_pb.ErrNotFound { + if errors.Is(err, filer_pb.ErrNotFound) { return credential.ErrGroupNotFound } return err @@ -135,7 +135,7 @@ func (store *FilerEtcStore) ListGroups(ctx context.Context) ([]string, error) { err := store.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { entries, err := listEntries(ctx, client, filer.IamConfigDirectory+"/"+IamGroupsDirectory) if err != nil { - if err == filer_pb.ErrNotFound { + if errors.Is(err, filer_pb.ErrNotFound) { return nil } return err