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

Function validate_view_name

libatomic/src/daemon/services_query.rs:1144–1164  ·  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

1142/// The CLI's view-name rules (ported so the daemon refuses the same
1143/// names the local path would).
1144fn validate_view_name(name: &str) -> Result<(), Status> {
1145 if name.is_empty() {
1146 return Err(domain_status(
1147 ErrorCode::InvalidArgument,
1148 "view name cannot be empty",
1149 ));
1150 }
1151 if name.len() > 100 {
1152 return Err(domain_status(
1153 ErrorCode::InvalidArgument,
1154 "view name cannot exceed 100 characters",
1155 ));
1156 }
1157 if name.contains("..") || name.contains('/') || name.contains('\\') {
1158 return Err(domain_status(
1159 ErrorCode::InvalidArgument,
1160 "view name cannot contain '..' or path separators",
1161 ));
1162 }
1163 Ok(())
1164}
1165
1166// ---------------------------------------------------------------------------
1167// 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