Skip to content

Commit

Permalink
fix: fix custom List command print invalid zero information
Browse files Browse the repository at this point in the history
close #963
  • Loading branch information
caotinghan committed Jul 29, 2024
1 parent e2d326b commit b47adf0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/custom/list_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ func List(ctx context.Context, cfg *config.Config) ([]storage.Backup, error) {
args := ApplyCommandTemplate(cfg.Custom.ListCommand, templateData)
out, err := utils.ExecCmdOut(ctx, cfg.Custom.CommandTimeoutDuration, args[0], args[1:]...)
if err == nil {
outLines := strings.Split(strings.TrimRight(out, "\n"), "\n")
outLines := make([]string, 0)
outTrim := strings.TrimRight(out, "\n")
if outTrim != "" {
outLines = strings.Split(outTrim, "\n")
}

backupList := make([]storage.Backup, len(outLines))
for i, line := range outLines {
if len(line) > 0 {
Expand Down

0 comments on commit b47adf0

Please sign in to comment.