Skip to main content

encode_cmd

Function encode_cmd 

Source
pub fn encode_cmd(cmd: &str) -> String
Expand description

Percent-encode a command string for safe inclusion in a URL path.

Only unreserved characters (alphanumeric, -, _, ., ~) are kept as-is. Everything else is encoded as %XX using uppercase hex. This prevents URL injection via crafted command strings containing &, %, ?, #, etc.