From 1196c96a9de1d8450afb07b7373781786eac9f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Thu, 1 Aug 2024 10:30:18 +0200 Subject: [PATCH] Do not clean up the trash item when only a subdirectory was restored --- pkg/storage/fs/posix/trashbin/trashbin.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/storage/fs/posix/trashbin/trashbin.go b/pkg/storage/fs/posix/trashbin/trashbin.go index 341001e446..a417478aaf 100644 --- a/pkg/storage/fs/posix/trashbin/trashbin.go +++ b/pkg/storage/fs/posix/trashbin/trashbin.go @@ -248,7 +248,11 @@ func (tb *Trashbin) RestoreRecycleItem(ctx context.Context, ref *provider.Refere tb.lu.CacheID(ctx, n.SpaceID, string(id), restorePath) // cleanup trash info - return os.Remove(filepath.Join(trashRoot, "info", key+".trashinfo")) + if relativePath == "." || relativePath == "/" { + return os.Remove(filepath.Join(trashRoot, "info", key+".trashinfo")) + } else { + return nil + } } // PurgeRecycleItem purges the specified item, all its children and all their revisions