From e55fa6884836d977eeed0d66346a5fa6eadef4bd Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:14:00 +0500 Subject: [PATCH] fix: excludeFileName is empty --- weed/command/filer_backup.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/weed/command/filer_backup.go b/weed/command/filer_backup.go index 2ae48cd40..cd63f49f7 100644 --- a/weed/command/filer_backup.go +++ b/weed/command/filer_backup.go @@ -93,9 +93,12 @@ func doFilerBackup(grpcDialOption grpc.DialOption, backupOption *FilerBackupOpti sourceFiler := pb.ServerAddress(*backupOption.filer) sourcePath := *backupOption.path excludePaths := util.StringSplit(*backupOption.excludePaths, ",") - reExcludeFileName, err := regexp.Compile(*backupOption.excludeFileName) - if err != nil { - return fmt.Errorf("error compile regexp %v for exclude file name: %+v", *backupOption.excludeFileName, err) + var reExcludeFileName *regexp.Regexp + if *backupOption.excludeFileName != "" { + var err error + if reExcludeFileName, err = regexp.Compile(*backupOption.excludeFileName); err != nil { + return fmt.Errorf("error compile regexp %v for exclude file name: %+v", *backupOption.excludeFileName, err) + } } timeAgo := *backupOption.timeAgo targetPath := dataSink.GetSinkToDirectory()