From: Jeff Ober Date: Fri, 17 Jan 2020 15:06:46 +0000 (-0500) Subject: Fix bug in generation of quoted keys containing quotes themselves X-Git-Tag: nailing-cargo/1.0.0~234^2~30 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c42e3143d07a16993db3c1995d75f2d185870215;p=nailing-cargo.git Fix bug in generation of quoted keys containing quotes themselves --- diff --git a/lib/TOML/Tiny/Writer.pm b/lib/TOML/Tiny/Writer.pm index 7c3067b..f5ee59f 100644 --- a/lib/TOML/Tiny/Writer.pm +++ b/lib/TOML/Tiny/Writer.pm @@ -157,7 +157,11 @@ sub to_toml_key { return $str; } - return qq{"$str"}; + if ($str =~ /^"/) { + return qq{'$str'}; + } else { + return qq{"$str"}; + } } sub to_toml_string {