From 40b04c00efb305596f7db82ef771a5ac65b20bed Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 20 May 2024 13:19:51 +0300 Subject: [PATCH] [#1141] metabase: Fix `IsUserObject` method Signed-off-by: Airat Arifullin --- pkg/local_object_storage/metabase/counter.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/local_object_storage/metabase/counter.go b/pkg/local_object_storage/metabase/counter.go index 4d860261..275099ff 100644 --- a/pkg/local_object_storage/metabase/counter.go +++ b/pkg/local_object_storage/metabase/counter.go @@ -527,10 +527,14 @@ func containerObjectCounterInitialized(tx *bbolt.Tx) bool { } func IsUserObject(obj *objectSDK.Object) bool { - _, hasParentID := obj.ParentID() - return obj.Type() == objectSDK.TypeRegular && - (obj.SplitID() == nil || - (hasParentID && len(obj.Children()) == 0)) + ech := obj.ECHeader() + if ech == nil { + _, hasParentID := obj.ParentID() + return obj.Type() == objectSDK.TypeRegular && + (obj.SplitID() == nil || + (hasParentID && len(obj.Children()) == 0)) + } + return ech.Index() == 0 && (ech.ParentSplitID() == nil || ech.ParentSplitParentID() != nil) } // ZeroSizeContainers returns containers with size = 0.