mirror of
https://github.com/rclone/rclone.git
synced 2025-04-16 16:18:52 +08:00
purge: exit with a fatal error if filters are set on rclone purge
Fixes #8491
This commit is contained in:
parent
9e62fa8c81
commit
bbaa1d14f3
@ -5,6 +5,8 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/filter"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@ -35,6 +37,11 @@ implement this command directly, in which case ` + "`--checkers`" + ` will be ig
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
fdst := cmd.NewFsDir(args)
|
||||
cmd.Run(true, false, command, func() error {
|
||||
ctx := context.Background()
|
||||
fi := filter.GetConfig(ctx)
|
||||
if !fi.InActive() {
|
||||
fs.Fatalf(nil, "filters are not supported with purge (purge will delete everything unconditionally)")
|
||||
}
|
||||
return operations.Purge(context.Background(), fdst, "")
|
||||
})
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user