1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-12 10:40:55 +09:00

GO-3531: Files: fix deleting of broken files

This commit is contained in:
Sergey 2024-06-17 11:22:50 +02:00
parent 629af192c4
commit 17625e94e2
No known key found for this signature in database
GPG key ID: 3B6BEF79160221C6

View file

@ -2,11 +2,13 @@ package block
import (
"context"
"errors"
"fmt"
"github.com/anyproto/anytype-heart/core/block/editor/smartblock"
"github.com/anyproto/anytype-heart/core/domain"
"github.com/anyproto/anytype-heart/core/event"
"github.com/anyproto/anytype-heart/core/files/fileobject"
"github.com/anyproto/anytype-heart/pb"
"github.com/anyproto/anytype-heart/pkg/lib/bundle"
coresb "github.com/anyproto/anytype-heart/pkg/lib/core/smartblock"
@ -42,7 +44,7 @@ func (s *Service) DeleteObjectByFullID(id domain.FullID) error {
return fmt.Errorf("subobjects deprecated")
case coresb.SmartBlockTypeFileObject:
err = s.fileObjectService.DeleteFileData(id.ObjectID)
if err != nil {
if err != nil && !errors.Is(err, fileobject.ErrEmptyFileId) {
return fmt.Errorf("delete file data: %w", err)
}
err = spc.DeleteTree(context.Background(), id.ObjectID)