You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Prevent using name with leading dot when create/rename/duplicate scene/folder/script/resource
Fixes #62497
This commit is contained in:
@@ -51,15 +51,22 @@ String DirectoryCreateDialog::_validate_path(const String &p_path) const {
|
||||
return TTR("Folder name cannot be empty.");
|
||||
}
|
||||
|
||||
if (p_path.find("\\") != -1 || p_path.find(":") != -1 || p_path.find("*") != -1 ||
|
||||
p_path.find("|") != -1 || p_path.find(">") != -1) {
|
||||
return TTR("Folder name contains invalid characters.");
|
||||
}
|
||||
|
||||
const Vector<String> parts = p_path.split("/");
|
||||
for (int i = 0; i < parts.size(); i++) {
|
||||
const String part = parts[i];
|
||||
if (part.empty()) {
|
||||
return TTR("Folder name cannot be empty.");
|
||||
}
|
||||
if (p_path.find("\\") != -1 || p_path.find(":") != -1 || p_path.find("*") != -1 ||
|
||||
p_path.find("|") != -1 || p_path.find(">") != -1 || p_path.ends_with(".") || p_path.ends_with(" ")) {
|
||||
return TTR("Folder name contains invalid characters.");
|
||||
if (part.ends_with(" ") || part[0] == ' ') {
|
||||
return TTR("Folder name cannot begin or end with a space.");
|
||||
}
|
||||
if (part[0] == '.') {
|
||||
return TTR("Folder name cannot begin with a dot.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user