mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 17:44:59 +09:00
GO-1340: Fix offload bug
This commit is contained in:
parent
676cf39ff7
commit
0c7d14f846
1 changed files with 3 additions and 2 deletions
|
@ -97,11 +97,11 @@ func (s *service) FileListOffload(fileIDs []string, includeNotPinned bool) (tota
|
|||
}
|
||||
|
||||
func (s *service) isFileDeleted(fileID string) (bool, error) {
|
||||
_, err := s.fileStore.GetByHash(fileID)
|
||||
roots, err := s.fileStore.ListByTarget(fileID)
|
||||
if err == localstore.ErrNotFound {
|
||||
return true, nil
|
||||
}
|
||||
return false, err
|
||||
return len(roots) == 0, err
|
||||
}
|
||||
|
||||
func (s *service) keepOnlyPinnedOrDeleted(fileIDs []string) ([]string, error) {
|
||||
|
@ -114,6 +114,7 @@ func (s *service) keepOnlyPinnedOrDeleted(fileIDs []string) ([]string, error) {
|
|||
for _, fileStat := range fileStats {
|
||||
if fileStat.IsPinned() {
|
||||
fileIDs = append(fileIDs, fileStat.FileId)
|
||||
continue
|
||||
}
|
||||
isDeleted, err := s.isFileDeleted(fileStat.FileId)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue