Skip to content

Commit

Permalink
fluvio_hub_util: allow ':' for sdf namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
digikata committed Jun 3, 2024
1 parent 577d597 commit df884e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
3 changes: 2 additions & 1 deletion crates/fluvio-hub-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
4 changes: 2 additions & 2 deletions crates/fluvio-hub-protocol/src/package_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
13 changes: 1 addition & 12 deletions crates/fluvio-hub-util/src/package_meta_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit df884e4

Please sign in to comment.