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

Function trim_container_name_tail

crates/openshell-driver-docker/src/lib.rs:2993–3002  ·  view source on GitHub ↗

Docker container names may not end with `-`, `.`, or `_`. Truncation can leave one of those trailing, so strip them before returning.

(mut value: String)

Source from the content-addressed store, hash-verified

2991/// Docker container names may not end with `-`, `.`, or `_`. Truncation can
2992/// leave one of those trailing, so strip them before returning.
2993fn trim_container_name_tail(mut value: String) -> String {
2994 while value
2995 .chars()
2996 .last()
2997 .is_some_and(|ch| matches!(ch, '-' | '.' | '_'))
2998 {
2999 value.pop();
3000 }
3001 value
3002}
3003
3004fn sanitize_docker_name(value: &str) -> String {
3005 value

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected