MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / push_redacted

Function push_redacted

atomic-cli/src/logging/redact.rs:25–37  ·  view source on GitHub ↗

Push `url` (what follows `scheme://`, up to whitespace) without its credentials.

(out: &mut String, url: &str)

Source from the content-addressed store, hash-verified

23/// Push `url` (what follows `scheme://`, up to whitespace) without its
24/// credentials.
25fn push_redacted(out: &mut String, url: &str) {
26 let host_and_rest = match url.rfind('@') {
27 Some(at) => {
28 out.push_str("***@");
29 &url[at + 1..]
30 }
31 None => url,
32 };
33 let end = host_and_rest
34 .find(['?', '#'])
35 .unwrap_or(host_and_rest.len());
36 out.push_str(&host_and_rest[..end]);
37}
38
39#[cfg(test)]
40mod tests {

Callers 1

urlsFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected