mirror of https://github.com/Xhofe/alist
feat: deleting folders is not allowed (close #6933)
parent
81258d3e8a
commit
2e4265a778
|
@ -466,6 +466,9 @@ func Remove(ctx context.Context, storage driver.Driver, path string) error {
|
||||||
if storage.Config().CheckStatus && storage.GetStorage().Status != WORK {
|
if storage.Config().CheckStatus && storage.GetStorage().Status != WORK {
|
||||||
return errors.Errorf("storage not init: %s", storage.GetStorage().Status)
|
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)
|
path = utils.FixAndCleanPath(path)
|
||||||
rawObj, err := Get(ctx, storage, path)
|
rawObj, err := Get(ctx, storage, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue