feat: deleting folders is not allowed (close #6933)

pull/6943/head
Andy Hsu 2024-08-04 18:28:35 +08:00
parent 81258d3e8a
commit 2e4265a778
1 changed files with 3 additions and 0 deletions

View File

@ -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 {