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

Function validate_view_hint

atomic-repository/src/git_binding/codec.rs:389–408  ·  view source on GitHub ↗
(hint: Option<&str>)

Source from the content-addressed store, hash-verified

387}
388
389fn validate_view_hint(hint: Option<&str>) -> Result<(), BindingEncodeError> {
390 let Some(hint) = hint else {
391 return Ok(());
392 };
393 let malformed = hint.is_empty()
394 || hint.len() > 255
395 || hint.starts_with('/')
396 || hint.ends_with('/')
397 || hint.contains("//")
398 || hint.contains("refs/")
399 || hint
400 .chars()
401 .any(|character| character.is_control() || character.is_whitespace());
402 if malformed {
403 return Err(BindingEncodeError::InvalidViewHint {
404 hint: hint.to_string(),
405 });
406 }
407 Ok(())
408}
409
410/// Blake3-derived binding identity: `ID_DOMAIN || payload || signature`.
411#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]

Callers 1

validateMethod · 0.85

Calls 4

is_emptyMethod · 0.45
lenMethod · 0.45
containsMethod · 0.45
is_whitespaceMethod · 0.45

Tested by

no test coverage detected