MCPcopy Create free account
hub / github.com/PerroEngine/Perro / validate_write_path

Function validate_write_path

perro_source/api_modules/perro_modules/src/file.rs:115–129  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

113 }
114 }
115}
116
117fn validate_write_path(path: &str) -> io::Result<()> {
118 if path.starts_with("user://") {
119 validate_virtual_asset_path(path)?;
120 return Ok(());
121 }
122
123 if Path::new(path).is_absolute() {
124 return Ok(());
125 }
126
127 Err(io::Error::new(
128 io::ErrorKind::PermissionDenied,
129 "writes are restricted to `user://` or absolute paths",
130 ))
131}
132

Callers 1

save_bytesFunction · 0.70

Calls 1

Tested by

no test coverage detected