Skip to content

Commit

Permalink
Fix deleting references to subtrees that have been restored
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Feb 14, 2023
1 parent 06904e1 commit 26c253a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/storage/utils/decomposedfs/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,12 @@ func (t *Tree) RestoreRecycleItemFunc(ctx context.Context, spaceid, key, trashPa
}

// delete item link in trash
if err = os.Remove(trashItem); err != nil {
resolvedTrashItem, err := filepath.EvalSymlinks(trashItem)
if err != nil {
return errors.Wrap(err, "Decomposedfs: could not resolve trash item")
}
deletePath := filepath.Join(resolvedTrashItem+".children", trashPath)
if err = os.Remove(deletePath); err != nil {
log.Error().Err(err).Str("trashItem", trashItem).Msg("error deleting trash item")
}

Expand Down

0 comments on commit 26c253a

Please sign in to comment.