Browse Source

Escape node names when saving to .tscn

Fixes #29401

(cherry picked from commit cc004485bc994c39065a8a4a6cff861a383f6fb0)
Bojidar Marinov 6 years ago
parent
commit
22abeff592
1 changed files with 3 additions and 3 deletions
  1. 3 3
      scene/resources/resource_format_text.cpp

+ 3 - 3
scene/resources/resource_format_text.cpp

@@ -1664,15 +1664,15 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
 			Vector<StringName> groups = state->get_node_groups(i);
 			Vector<StringName> groups = state->get_node_groups(i);
 
 
 			String header = "[node";
 			String header = "[node";
-			header += " name=\"" + String(name) + "\"";
+			header += " name=\"" + String(name).c_escape() + "\"";
 			if (type != StringName()) {
 			if (type != StringName()) {
 				header += " type=\"" + String(type) + "\"";
 				header += " type=\"" + String(type) + "\"";
 			}
 			}
 			if (path != NodePath()) {
 			if (path != NodePath()) {
-				header += " parent=\"" + String(path.simplified()) + "\"";
+				header += " parent=\"" + String(path.simplified()).c_escape() + "\"";
 			}
 			}
 			if (owner != NodePath() && owner != NodePath(".")) {
 			if (owner != NodePath() && owner != NodePath(".")) {
-				header += " owner=\"" + String(owner.simplified()) + "\"";
+				header += " owner=\"" + String(owner.simplified()).c_escape() + "\"";
 			}
 			}
 			if (index >= 0) {
 			if (index >= 0) {
 				header += " index=\"" + itos(index) + "\"";
 				header += " index=\"" + itos(index) + "\"";