Skip to content

Commit

Permalink
Warn about not escaping whitespace in an entity path
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Dec 14, 2023
1 parent cccb18b commit ab059a0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/re_log_types/src/path/entity_path_part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ impl EntityPathPart {

/// Unescape the string, forgiving any syntax error with a best-effort approach.
///
/// Returns a warnings if there was any unknown escape sequences.
/// Returns a warnings for potentially serious problems:
/// * any unknown escape sequences
/// * unescaped spaces
pub fn parse_forgiving_with_warning(
input: &str,
mut warnings: Option<&mut Vec<String>>,
Expand Down Expand Up @@ -88,6 +90,13 @@ impl EntityPathPart {
output.push('\\');
}
} else {
if c.is_whitespace() {
if let Some(warnings) = warnings.as_mut() {
// This could be a sign of forgetting to split a string containing multiple entity paths.
warnings.push("Unescaped whitespace".to_owned());
}
}

output.push(c);
}
}
Expand Down

0 comments on commit ab059a0

Please sign in to comment.