diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-16 02:26:14 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-16 02:26:14 +0300 |
| commit | 72770305d388fd5ec247493e05a89b686c6d0026 (patch) | |
| tree | 44d95c9c69042ab07e27ace37853e190b6f00ba0 /src/app/api_helpers.rs | |
| parent | 58c379f1f07adb4113e5f9ee673768b2e4b5be07 (diff) | |
feat: add hook-owned custom agent status labels
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()) +} |
