From f92bd01c94e988cd022161483e7e248365a9f001 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Wed, 22 Dec 2021 12:52:45 -0800 Subject: [PATCH] Properly check against the HA array being empty Because of the way strings.Split works, the returned array will *always* have at least one element. If the string is empty, the array will be [""], so we need to check [1] == "" instead of checking the length. --- services/horizon/internal/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index 7c47c1292e..24ec311953 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -555,7 +555,7 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption // config.HistoryArchiveURLs contains a single empty value when empty so using // viper.GetString is easier. - if len(config.HistoryArchiveURLs) == 0 { + if len(config.HistoryArchiveURLs) == 1 && config.HistoryArchiveURLs[0] == "" { return fmt.Errorf("--history-archive-urls must be set when --ingest is set") }