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

Function validate_mount_source

crates/openshell-core/src/driver_mounts.rs:36–47  ·  view source on GitHub ↗

Validate a non-empty driver mount source.

(source: &str, field: &str)

Source from the content-addressed store, hash-verified

34
35/// Validate a non-empty driver mount source.
36pub fn validate_mount_source(source: &str, field: &str) -> Result<(), String> {
37 if source.is_empty() {
38 return Err(format!("{field} must not be empty"));
39 }
40 if source != source.trim() {
41 return Err(format!("{field} must not contain surrounding whitespace"));
42 }
43 if source.as_bytes().contains(&0) {
44 return Err(format!("{field} must not contain NUL bytes"));
45 }
46 Ok(())
47}
48
49/// Validate a bind mount source as an absolute host path.
50pub fn validate_absolute_mount_source(source: &str, field: &str) -> Result<(), String> {

Callers 4

podman_user_mountsFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected