Function normalize_path

Source
pub fn normalize_path(
    path: &str,
    path_type: SupportedPathType,
) -> MicrosandboxUtilsResult<String>
Expand description

Normalizes a path string for volume mount comparison.

Rules:

  • Resolves . and .. components where possible
  • Prevents path traversal that would escape the root
  • Removes redundant separators and trailing slashes
  • Case-sensitive comparison (Unix standard)
  • Can enforce path type requirements (absolute, relative, or any)

§Arguments

  • path - The path to normalize
  • path_type - The required path type (absolute, relative, or any)

§Returns

An error if the path is invalid, would escape root, or doesn’t meet path type requirement