fix regex of NURI

pull/19/head
Niko PLP 6 months ago
parent 2324182758
commit 79eea0384e
  1. 8
      ng-net/src/app_protocol.rs
  2. 8
      ng-oxigraph/src/oxigraph/storage/mod.rs

@ -26,16 +26,16 @@ use crate::types::*;
lazy_static! { lazy_static! {
#[doc(hidden)] #[doc(hidden)]
static ref RE_FILE_READ_CAP: Regex = static ref RE_FILE_READ_CAP: Regex =
Regex::new(r"^did:ng:j:([A-Za-z0-9-_%.]*):k:([A-Za-z0-9-_%.]*)$").unwrap(); Regex::new(r"^did:ng:j:([A-Za-z0-9-_]*):k:([A-Za-z0-9-_]*)$").unwrap();
#[doc(hidden)] #[doc(hidden)]
static ref RE_REPO: Regex = static ref RE_REPO: Regex =
Regex::new(r"^did:ng:o:([A-Za-z0-9-_%.]*):v:([A-Za-z0-9-_%.]*)$").unwrap(); Regex::new(r"^did:ng:o:([A-Za-z0-9-_]*):v:([A-Za-z0-9-_]*)$").unwrap();
#[doc(hidden)] #[doc(hidden)]
static ref RE_BRANCH: Regex = static ref RE_BRANCH: Regex =
Regex::new(r"^did:ng:o:([A-Za-z0-9-_%.]*):v:([A-Za-z0-9-_%.]*):b:([A-Za-z0-9-_%.]*)$").unwrap(); Regex::new(r"^did:ng:o:([A-Za-z0-9-_]*):v:([A-Za-z0-9-_]*):b:([A-Za-z0-9-_]*)$").unwrap();
#[doc(hidden)] #[doc(hidden)]
static ref RE_NAMED_BRANCH_OR_COMMIT: Regex = static ref RE_NAMED_BRANCH_OR_COMMIT: Regex =
Regex::new(r"^did:ng:o:([A-Za-z0-9-_%.]*):v:([A-Za-z0-9-_%.]*):a:([A-Za-z0-9-_%.]*)$").unwrap(); //TODO: allow international chars. disallow digit as first char Regex::new(r"^did:ng:o:([A-Za-z0-9-_]*):v:([A-Za-z0-9-_]*):a:([A-Za-z0-9-_%]*)$").unwrap(); //TODO: allow international chars. disallow digit as first char
} }
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]

@ -85,16 +85,16 @@ const DID_PREFIX: &str = "did:ng";
lazy_static! { lazy_static! {
#[doc(hidden)] #[doc(hidden)]
static ref RE_REPO: Regex = static ref RE_REPO: Regex =
Regex::new(r"^did:ng:o:([A-Za-z0-9-_%.]*):v:([A-Za-z0-9-_%.]*)$").unwrap(); Regex::new(r"^did:ng:o:([A-Za-z0-9-_]*):v:([A-Za-z0-9-_]*)$").unwrap();
#[doc(hidden)] #[doc(hidden)]
static ref RE_BRANCH: Regex = static ref RE_BRANCH: Regex =
Regex::new(r"^:b:([A-Za-z0-9-_%.]*)$").unwrap(); Regex::new(r"^:b:([A-Za-z0-9-_]*)$").unwrap();
#[doc(hidden)] #[doc(hidden)]
static ref RE_COMMITS: Regex = static ref RE_COMMITS: Regex =
Regex::new(r":c:([A-Za-z0-9-_%.]*)").unwrap(); Regex::new(r":c:([A-Za-z0-9-_]*)").unwrap();
#[doc(hidden)] #[doc(hidden)]
static ref RE_NAMED_BRANCH_OR_COMMIT: Regex = static ref RE_NAMED_BRANCH_OR_COMMIT: Regex =
Regex::new(r"^:a:([A-Za-z0-9-_%.]*)$").unwrap(); //TODO: allow international chars. disallow digit as first char Regex::new(r"^:a:([A-Za-z0-9-_%]*)$").unwrap(); //TODO: allow international chars. disallow digit as first char
} }
pub(crate) enum MatchBy { pub(crate) enum MatchBy {

Loading…
Cancel
Save