1
0
mirror of https://github.com/rclone/rclone.git synced 2025-08-10 06:09:44 +02:00

purge: exit with a fatal error if filters are set on rclone purge

Fixes #8491
This commit is contained in:
Nick Craig-Wood
2025-04-08 21:12:36 +01:00
parent c9730bcaaf
commit ccfe153e9b

View File

@@ -5,6 +5,8 @@ import (
"context" "context"
"github.com/rclone/rclone/cmd" "github.com/rclone/rclone/cmd"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/filter"
"github.com/rclone/rclone/fs/operations" "github.com/rclone/rclone/fs/operations"
"github.com/spf13/cobra" "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) cmd.CheckArgs(1, 1, command, args)
fdst := cmd.NewFsDir(args) fdst := cmd.NewFsDir(args)
cmd.Run(true, false, command, func() error { 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, "") return operations.Purge(context.Background(), fdst, "")
}) })
}, },