Escape double quotes in TXT.

This commit is contained in:
Philippe Pittoli 2024-12-10 11:31:15 +01:00
parent bfcba42375
commit 177da35f6e

View File

@ -236,11 +236,11 @@ class DNSManager::Storage::Zone
def to_s(io : IO) def to_s(io : IO)
io << "(#{ "%4d" % @rrid }) " 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 end
def to_bind9(io : IO) 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
end end
@ -1110,3 +1110,7 @@ def quoted_string(value : String) : String
io << '"' io << '"'
end end
end end
def escape_double_quotes(value : String)
value.gsub '"', %[\\"]
end