chiark / gitweb /
Fix bug in generation of quoted keys containing quotes themselves
authorJeff Ober <jober@ziprecruiter.com>
Fri, 17 Jan 2020 15:06:46 +0000 (10:06 -0500)
committerJeff Ober <jober@ziprecruiter.com>
Fri, 17 Jan 2020 15:06:46 +0000 (10:06 -0500)
lib/TOML/Tiny/Writer.pm

index 7c3067bde2a32a13ff623670165baed81f328877..f5ee59f9b38ec1fe8709dc086ac58af5ff171c7b 100644 (file)
@@ -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 {