MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / validate_project_id

Function validate_project_id

src/storage.rs:651–669  ·  view source on GitHub ↗
(project_id: &str)

Source from the content-addressed store, hash-verified

649}
650
651pub(crate) fn validate_project_id(project_id: &str) -> std::result::Result<(), &'static str> {
652 if project_id.is_empty() {
653 return Err("project_id must not be empty");
654 }
655 if project_id.starts_with('.')
656 || project_id.contains('/')
657 || project_id.contains('\\')
658 || project_id.contains("..")
659 {
660 return Err("project_id must be a single safe path segment");
661 }
662 if !project_id
663 .bytes()
664 .all(|b| b.is_ascii_alphanumeric() || matches!(b, b'_' | b'-' | b'.'))
665 {
666 return Err("project_id contains unsupported characters");
667 }
668 Ok(())
669}
670
671fn validate_no_nul(path: &Path) -> Result<()> {
672 if path.to_string_lossy().contains('\0') {

Callers 6

profile_sharded_layoutFunction · 0.85
build_plan_manifestFunction · 0.85
export_profile_storeFunction · 0.85
manifest_destinationFunction · 0.85

Calls 2

is_emptyMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected