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

Function sanitize_id

atomic-repository/src/intent_bridge.rs:96–106  ·  view source on GitHub ↗

Sanitize an intent id/key for use as a directory name in the sidecar/vault path. Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`.

(id: &str)

Source from the content-addressed store, hash-verified

94/// Sanitize an intent id/key for use as a directory name in the sidecar/vault
95/// path. Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`.
96fn sanitize_id(id: &str) -> String {
97 id.chars()
98 .map(|c| {
99 if c.is_ascii_alphanumeric() || c == '-' || c == '_' {
100 c
101 } else {
102 '_'
103 }
104 })
105 .collect()
106}
107
108/// The normalized intent id used to key BOTH the tracked vault attestation path
109/// and the legacy `.atomic` sidecar dir, so the dual-read fallback lines up

Callers 3

sidecar_dirFunction · 0.70

Calls 1

collectMethod · 0.45