diff --git a/src/storage/zone.cr b/src/storage/zone.cr index 3cd1e3f..3538f10 100644 --- a/src/storage/zone.cr +++ b/src/storage/zone.cr @@ -236,11 +236,11 @@ class DNSManager::Storage::Zone def to_s(io : IO) io << "(#{ "%4d" % @rrid }) " - io << "#{ "%.30s" % @name} #{ "%6d" % @ttl} #{ "%.10s" % @rrtype } #{quoted_string @target}\n" + io << "#{ "%.30s" % @name} #{ "%6d" % @ttl} #{ "%.10s" % @rrtype } #{quoted_string escape_double_quotes @target}\n" end def to_bind9(io : IO) - io << "#{@name} #{@ttl} IN #{@rrtype} #{split_line @target}\n" + io << "#{@name} #{@ttl} IN #{@rrtype} #{split_line escape_double_quotes @target}\n" end end @@ -1110,3 +1110,7 @@ def quoted_string(value : String) : String io << '"' end end + +def escape_double_quotes(value : String) + value.gsub '"', %[\\"] +end