UCE Docs / request_query_path

Signature

String request_query_path(Request& context, String default_path = "index")

Returns the first keyless query-string segment as a sanitized route path.

For a request such as /?workspace/projects&theme=dark, this returns workspace/projects.

When no keyless route is supplied, the result is default_path. When unsafe route input is supplied, the result is an empty string. Unsafe route input includes . or .. segments, empty interior segments, backslashes, dots in filenames, or any character outside ASCII letters, digits, _, and -.

The runtime-populated context.params["ROUTE_PATH"] uses the same sanitizer.

Example

print(request_query_path(context, "index") != "" ? "path\n" : "empty\n");
Output
path