MCPcopy Create free account
hub / github.com/Botloader/botloader / check_script_name

Function check_script_name

components/validation/src/web.rs:639–653  ·  view source on GitHub ↗
(ctx: &mut ValidationContext, name: &str)

Source from the content-addressed store, hash-verified

637}
638
639fn check_script_name(ctx: &mut ValidationContext, name: &str) {
640 if name.chars().count() > 32 {
641 ctx.push_field_error("name", "name can be max 32 characters long".to_string());
642 }
643
644 lazy_static! {
645 static ref RE: Regex = Regex::new(r#"^[\w_-]*$"#).unwrap();
646 }
647 if !RE.is_match(name) {
648 ctx.push_field_error(
649 "name",
650 "name can only contain 'a-z', '-' and '_'".to_string(),
651 );
652 }
653}
654
655pub fn check_script_source(ctx: &mut ValidationContext, field_name: &str, source: &str) {
656 if source.len() > 100_000 {

Callers 1

validateMethod · 0.85

Calls 2

countMethod · 0.80
push_field_errorMethod · 0.80

Tested by

no test coverage detected