diff options
-rw-r--r-- | tvix/store/src/store_path.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tvix/store/src/store_path.rs b/tvix/store/src/store_path.rs index 925a0b4ccff2..f437edb6b2d8 100644 --- a/tvix/store/src/store_path.rs +++ b/tvix/store/src/store_path.rs @@ -64,7 +64,7 @@ impl StorePath { return Err(ParseStorePathError::MissingDash()); } - StorePath::validate_characters(&s[ENCODED_DIGEST_SIZE + 2..])?; + StorePath::validate_name(&s[ENCODED_DIGEST_SIZE + 2..])?; Ok(StorePath { name: s[ENCODED_DIGEST_SIZE + 1..].to_string(), @@ -87,7 +87,8 @@ impl StorePath { format!("{}/{}", STORE_DIR, self) } - fn validate_characters(s: &str) -> Result<(), ParseStorePathError> { + /// Checks a given &str to match the restrictions for store path names. + pub fn validate_name(s: &str) -> Result<(), ParseStorePathError> { for c in s.chars() { if c.is_ascii_alphanumeric() || c == '-' |