MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validated_gateway_name

Function validated_gateway_name

crates/openshell-bootstrap/src/paths.rs:41–49  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

39}
40
41pub fn validated_gateway_name(name: &str) -> Result<&str> {
42 let mut components = Path::new(name).components();
43 match (components.next(), components.next()) {
44 (Some(Component::Normal(component)), None) if component == OsStr::new(name) => Ok(name),
45 _ => Err(miette::miette!(
46 "invalid gateway name '{name}': expected a single path component"
47 )),
48 }
49}
50
51pub fn user_gateway_dir(name: &str) -> Result<PathBuf> {
52 Ok(user_gateways_dir()?.join(validated_gateway_name(name)?))

Callers 4

save_active_gatewayFunction · 0.85
read_gateway_nameFunction · 0.85
user_gateway_dirFunction · 0.85
system_gateway_dirFunction · 0.85

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected