fix: excludeFileName is empty

This commit is contained in:
Konstantin Lebedev 2023-11-13 19:14:00 +05:00 committed by Chris Lu
parent 3c5295a1a6
commit e55fa68848

View file

@ -93,10 +93,13 @@ func doFilerBackup(grpcDialOption grpc.DialOption, backupOption *FilerBackupOpti
sourceFiler := pb.ServerAddress(*backupOption.filer) sourceFiler := pb.ServerAddress(*backupOption.filer)
sourcePath := *backupOption.path sourcePath := *backupOption.path
excludePaths := util.StringSplit(*backupOption.excludePaths, ",") excludePaths := util.StringSplit(*backupOption.excludePaths, ",")
reExcludeFileName, err := regexp.Compile(*backupOption.excludeFileName) var reExcludeFileName *regexp.Regexp
if err != nil { 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) return fmt.Errorf("error compile regexp %v for exclude file name: %+v", *backupOption.excludeFileName, err)
} }
}
timeAgo := *backupOption.timeAgo timeAgo := *backupOption.timeAgo
targetPath := dataSink.GetSinkToDirectory() targetPath := dataSink.GetSinkToDirectory()
debug := *backupOption.debug debug := *backupOption.debug