From 9a503b1cfd4a22c606d9a3f50b9b01380a4dae68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Tue, 10 Sep 2024 11:36:39 +0200 Subject: [PATCH] Fix broken cached metadata after restore --- pkg/storage/fs/posix/trashbin/trashbin.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/storage/fs/posix/trashbin/trashbin.go b/pkg/storage/fs/posix/trashbin/trashbin.go index b8b0a7d0f2..f0fed08e16 100644 --- a/pkg/storage/fs/posix/trashbin/trashbin.go +++ b/pkg/storage/fs/posix/trashbin/trashbin.go @@ -129,15 +129,14 @@ func (tb *Trashbin) MoveToTrash(ctx context.Context, n *node.Node, path string) if err = tb.lu.IDCache.DeleteByPath(ctx, path); err != nil { return err } - if err != nil { - return err - } - err = tb.lu.MetadataBackend().Rename(path, trashPath) + + itemTrashPath := filepath.Join(trashPath, "files", key+".trashitem") + err = tb.lu.MetadataBackend().Rename(path, itemTrashPath) if err != nil { return err } - return os.Rename(path, filepath.Join(trashPath, "files", key+".trashitem")) + return os.Rename(path, itemTrashPath) } // ListRecycle returns the list of available recycle items