Escape node names when saving to .tscn

Fixes #29401
This commit is contained in:
Bojidar Marinov 2019-06-03 16:54:41 +03:00
parent 4b399034aa
commit cc004485bc
No known key found for this signature in database
GPG key ID: 4D546A8F1E091856

View file

@ -1712,15 +1712,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) + "\"";