From 2e4265a778778f6236d4a42112064632d8c48a2c Mon Sep 17 00:00:00 2001 From: Andy Hsu Date: Sun, 4 Aug 2024 18:28:35 +0800 Subject: [PATCH] feat: deleting folders is not allowed (close #6933) --- internal/op/fs.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/op/fs.go b/internal/op/fs.go index 5c9c9f3f138..ed28039529f 100644 --- a/internal/op/fs.go +++ b/internal/op/fs.go @@ -466,6 +466,9 @@ func Remove(ctx context.Context, storage driver.Driver, path string) error { if storage.Config().CheckStatus && storage.GetStorage().Status != WORK { return errors.Errorf("storage not init: %s", storage.GetStorage().Status) } + if utils.PathEqual(path, "/") { + return errors.New("delete root folder is not allowed, please goto the manage page to delete the storage instead") + } path = utils.FixAndCleanPath(path) rawObj, err := Get(ctx, storage, path) if err != nil {