MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / validate_view_name

Function validate_view_name

libatomic/src/daemon/services_query.rs:1147–1167  ·  view source on GitHub ↗

The CLI's view-name rules (ported so the daemon refuses the same names the local path would).

(name: &str)

Source from the content-addressed store, hash-verified

1145/// The CLI's view-name rules (ported so the daemon refuses the same
1146/// names the local path would).
1147fn validate_view_name(name: &str) -> Result<(), Status> {
1148 if name.is_empty() {
1149 return Err(domain_status(
1150 ErrorCode::InvalidArgument,
1151 "view name cannot be empty",
1152 ));
1153 }
1154 if name.len() > 100 {
1155 return Err(domain_status(
1156 ErrorCode::InvalidArgument,
1157 "view name cannot exceed 100 characters",
1158 ));
1159 }
1160 if name.contains("..") || name.contains('/') || name.contains('\\') {
1161 return Err(domain_status(
1162 ErrorCode::InvalidArgument,
1163 "view name cannot contain '..' or path separators",
1164 ));
1165 }
1166 Ok(())
1167}
1168
1169// ---------------------------------------------------------------------------
1170// Goals — `atomic vault goal list` (ListVaultEntries kind=GOAL)

Callers 1

create_viewMethod · 0.70

Calls 4

domain_statusFunction · 0.85
is_emptyMethod · 0.45
lenMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected