From fa7d67dab414a1dd814912f3f2c44f595500ef9b Mon Sep 17 00:00:00 2001 From: David Adrian Date: Sun, 10 Sep 2023 11:05:50 -0600 Subject: [PATCH] Allow for escaped commas in CLI input (#330) Fixes #329 Co-authored-by: Zakir Durumeric --- pkg/zdns/lookup.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/zdns/lookup.go b/pkg/zdns/lookup.go index b3402524..4a348b0c 100644 --- a/pkg/zdns/lookup.go +++ b/pkg/zdns/lookup.go @@ -15,6 +15,7 @@ package zdns import ( + "encoding/csv" "encoding/json" "os" "strconv" @@ -68,7 +69,11 @@ func parseMetadataInputLine(line string) (string, string) { } func parseNormalInputLine(line string) (string, string) { - s := strings.SplitN(line, ",", 2) + r := csv.NewReader(strings.NewReader(line)) + s, err := r.Read() + if err != nil || len(s) == 0 { + return line, "" + } if len(s) == 1 { return s[0], "" } else {