MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / normalize_mount_path

Function normalize_mount_path

ra-rpc/src/openapi.rs:431–447  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

429}
430
431fn normalize_mount_path(path: &str) -> String {
432 if path.is_empty() {
433 return "/".to_string();
434 }
435 let mut normalized = path.trim().to_string();
436 if !normalized.starts_with('/') {
437 normalized.insert(0, '/');
438 }
439 if normalized.len() > 1 && normalized.ends_with('/') {
440 normalized.pop();
441 }
442 if normalized.is_empty() {
443 "/".to_string()
444 } else {
445 normalized
446 }
447}
448
449fn join_path(base: &str, segment: &str) -> String {
450 if base == "/" {

Callers 1

generate_documentFunction · 0.85

Calls 2

is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected