Skip to main content

is_valid_rename_stem

Function is_valid_rename_stem 

Source
fn is_valid_rename_stem(stem: &str) -> bool
Expand description

Whether stem is safe to use as a single filename component in EditorScene::rename_scene/ EditorScene::rename_script — both come straight from a text field the user typed into, with no validation of their own. PathBuf::with_file_name doesn’t resolve or reject //\ or ./.., it just folds them into the resulting path verbatim — so an untrusted stem like "../../outside" would let project.root.join(&new_path) resolve outside the project entirely. Rejecting anything but a single normal path component here keeps every renamed scene/script path project-root-relative, matching every other path this module hands out.