The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(redact): handle empty input in redact function
Steven Enamakeleea3c41e6d62
diff --git a/crates/openhuman-core/src/util/redact.rs b/crates/openhuman-core/src/util/redact.rsindex 7c1f300aac..4ae3668844 100644--- a/crates/openhuman-core/src/util/redact.rs+++ b/crates/openhuman-core/src/util/redact.rs@@ -39,6 +39,29 @@ pub fn redact(s: &str) -> String {)}+/// Redact a URL's userinfo (username/password) for safe logging.+///+/// Parses `raw` (falling back to an assumed `http://` scheme when it has+/// none), replaces any embedded username/password with the literal+/// `"redacted"`, and strips a trailing slash. Returns `raw` trimmed and+/// unchanged when it cannot be parsed as a URL at all.+#[must_use]+pub fn redact_url_for_log(raw: &str) -> String {+ let trimmed = raw.trim();+ let parsed =+ url::Url::parse(trimmed).or_else(|_| url::Url::parse(&format!("http://{trimmed}")));+ let Ok(mut parsed) = parsed else {+ return trimmed.to_string();+ };+ if !parsed.username().is_empty() {+ let _ = parsed.set_username("redacted");+ }+ if parsed.password().is_some() {+ let _ = parsed.set_password(Some("redacted"));+ }+ parsed.to_string().trim_end_matches('/').to_string()+}+#[cfg(test)]#[path = "redact_tests.rs"]mod tests;