diff --git a/crates/fluvio-hub-protocol/src/lib.rs b/crates/fluvio-hub-protocol/src/lib.rs index 773c60b109..079ee71950 100644 --- a/crates/fluvio-hub-protocol/src/lib.rs +++ b/crates/fluvio-hub-protocol/src/lib.rs @@ -5,4 +5,5 @@ pub mod constants; pub mod infinyon_tok; pub use errors::{Result, HubError}; -pub use package_meta::{PackageMeta, PkgTag, PkgVisibility, validate_noleading_punct}; +pub use package_meta::{PackageMeta, PkgTag, PkgVisibility}; +pub use package_meta::{validate_allowedchars, validate_noleading_punct}; diff --git a/crates/fluvio-hub-protocol/src/package_meta.rs b/crates/fluvio-hub-protocol/src/package_meta.rs index a2052c50f0..dbe60b098f 100644 --- a/crates/fluvio-hub-protocol/src/package_meta.rs +++ b/crates/fluvio-hub-protocol/src/package_meta.rs @@ -236,10 +236,10 @@ pub fn validate_lowercase(val: &str, name: &str) -> String { pub fn validate_allowedchars(val: &str, name: &str) -> String { let good_chars = val .chars() - .all(|ch| matches!(ch, 'a'..='z' | '0'..='9' | '-' | '_')); + .all(|ch| matches!(ch, 'a'..='z' | '0'..='9' | ':' | '-' | '_')); if !good_chars { - format!("{name} {val} should be alphanumeric, '-' or '_'\n") + format!("{name} {val} should be alphanumeric, ':', '-' or '_'\n") } else { String::new() } diff --git a/crates/fluvio-hub-util/src/package_meta_ext.rs b/crates/fluvio-hub-util/src/package_meta_ext.rs index f6482639f0..38934a0c23 100644 --- a/crates/fluvio-hub-util/src/package_meta_ext.rs +++ b/crates/fluvio-hub-util/src/package_meta_ext.rs @@ -6,6 +6,7 @@ use tracing::debug; use fluvio_hub_protocol::{PackageMeta, HubError}; use fluvio_hub_protocol::constants::HUB_PACKAGE_META; +use fluvio_hub_protocol::validate_allowedchars; use crate::package_get_topfile; @@ -85,18 +86,6 @@ pub fn validate_lowercase(val: &str, name: &str) -> String { } } -pub fn validate_allowedchars(val: &str, name: &str) -> String { - let good_chars = val - .chars() - .all(|ch| matches!(ch, 'a'..='z' | '0'..='9' | '-' | '_')); - - if !good_chars { - format!("{name} {val} should be alphanumeric, '-' or '_'\n") - } else { - String::new() - } -} - /// certain output files are transformed in name vs their package name /// eg. a cargo package named example-smartmodule generates /// a release file of example_smartmodule.wasm