[Bf-blender-cvs] [1b9de4fa337] master: BLI: escape double quotes in dot export

Jacques Lucke noreply at git.blender.org
Tue Oct 6 13:35:56 CEST 2020


Commit: 1b9de4fa3379cd74cb138c2f78960ce9831daf66
Author: Jacques Lucke
Date:   Tue Oct 6 13:35:12 2020 +0200
Branches: master
https://developer.blender.org/rB1b9de4fa3379cd74cb138c2f78960ce9831daf66

BLI: escape double quotes in dot export

===================================================================

M	source/blender/blenlib/intern/dot_export.cc

===================================================================

diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc
index 9ffb1895d04..eb15a51366e 100644
--- a/source/blender/blenlib/intern/dot_export.cc
+++ b/source/blender/blenlib/intern/dot_export.cc
@@ -225,7 +225,15 @@ void Attributes::export__as_bracket_list(std::stringstream &ss) const
       ss << key << "=" << value << ", ";
     }
     else {
-      ss << key << "=\"" << value << "\", ";
+      ss << key << "=\"";
+      for (char c : value) {
+        if (c == '\"') {
+          /* Escape double quotes. */
+          ss << '\\';
+        }
+        ss << c;
+      }
+      ss << "\", ";
     }
   });
   ss << "]";



More information about the Bf-blender-cvs mailing list