Files
test/source
Nathan Vegdahl d7c6cbc6bf Core: Sanitize ID/struct names when used in path templates
In #139438 we added three path template variables that get their values
from user-specified names:

- `scene_name`
- `camera_name`
- `node_name`

These names can contain characters that are illegal in filenames on some
systems, and also characters like "/" that would be interpreted as path
separators in a filepath. This can lead to unexpected outcomes.

For example, if a node's name is "Hue/Saturation" and the `{node_name}`
variable is used in a path, it would result in a "Hue" directory which
in turn contains a "Saturation" file. This is almost certainly not what
the user intended, because the slash in that name is not semantically
supposed to be a path separator.

This PR addresses this problem by splitting string variables into two
types: strings and filepaths. The contents of string variables are
sanitized to be valid filenames when substituted into a path template,
but the contents of filepath variables are left as-is.

Variables such as `blend_name`, `blend_dir`, etc. that actually
represent path components are then added as filepath variables, while
variables such as `scene_name` that represent plain strings without path
semantics are added as string variables.

Pull Request: https://projects.blender.org/blender/blender/pulls/142679
2025-07-22 14:47:56 +02:00
..