diff options
Diffstat (limited to 'src/app/api_helpers.rs')
| -rw-r--r-- | src/app/api_helpers.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/api_helpers.rs b/src/app/api_helpers.rs index 011e5ccb..56907ece 100644 --- a/src/app/api_helpers.rs +++ b/src/app/api_helpers.rs @@ -90,3 +90,12 @@ pub(super) fn normalize_reported_agent_label(agent: &str) -> Option<String> { } Some(trimmed.to_string()) } + +pub(super) fn normalize_custom_status(status: Option<String>) -> Option<String> { + let trimmed = status?.trim().to_string(); + let mut normalized = String::new(); + for ch in trimmed.chars().filter(|ch| !ch.is_control()).take(32) { + normalized.push(ch); + } + (!normalized.trim().is_empty()).then(|| normalized.trim().to_string()) +} |
