From 549ed97be13a55822e455dda27231dec93061e4a Mon Sep 17 00:00:00 2001 From: Andrew Tunnell-Jones Date: Sat, 11 Jan 2014 05:33:23 +0000 Subject: [PATCH] Fix parsing of TXT records containing empty-strings --- zscan_rr.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zscan_rr.go b/zscan_rr.go index 7c9f2226..1abf0b49 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -223,9 +223,11 @@ func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, stri switch l.value == _QUOTE { case true: // A number of quoted string s = make([]string, 0) + empty := true for l.value != _NEWLINE && l.value != _EOF { switch l.value { case _STRING: + empty = false s = append(s, l.token) case _BLANK: if quote { @@ -233,7 +235,11 @@ func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, stri return nil, &ParseError{f, errstr, l}, "" } case _QUOTE: + if empty && quote { + s = append(s, "") + } quote = !quote + empty = quote default: return nil, &ParseError{f, errstr, l}, "" }