Skip to main content

unsafe_asset_path_reason

Function unsafe_asset_path_reason 

Source
pub fn unsafe_asset_path_reason(path: &str) -> Option<&'static str>
Expand description

Why path is not a safe asset path, or None when it is.

An asset is public by construction, and the path is joined onto the project root to find the file, so a path that can name something outside the project is rejected outright: an absolute path (/etc/x, \x, C:/x), and any .. segment. Both separators count, so a Windows-style path is judged the same on every host. An empty path names no file.