Signature
String route_path_sanitize(String path, String default_path = "index")
Normalizes and validates a route path for file-backed routing.
Rules:
leading and trailing
/are removedan empty path becomes
default_pathevery path segment must be non-empty
.and..segments are rejectedonly ASCII letters, digits,
_, and-are accepted inside a segmentunsafe input returns an empty string
Use this instead of manually checking app routes before composing file paths.
request_query_path(), request_query_route(), and the runtime-populated ROUTE_PATH params already use this sanitizer.
Example
print(route_path_sanitize("../secret", "index"), "\n");
Output