INNER CODE UNIT · Rust
parse_try_file_arg
TheWaWaR/simple-http-server · src/config.rs:418
fn parse_try_file_arg(value: &str) -> Result<PathBuf, String> {
if value.is_empty() {
Err("Path can not be empty".to_owned())
} else {
Ok(PathBuf::from(value))
}
}
pub(crate) fn normalize_base_url(value: &str) -> Result<String, String> {
let trimmed = value.trim();
if trimmed.is_empty() {
return Err("base-url can not be empty".to_owned());
}
let mut normalized = if trimmed.starts_with('/') {
trimmed.to_owned()
} else {
format!("/{trimmed}")