Misc 5 #67

Merged
oysteikt merged 2 commits from misc into main 2024-08-19 00:50:14 +02:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit a6f00d4313 - Show all commits

View File

@ -76,6 +76,7 @@ impl OwnerValidationError {
indoc! {r#" indoc! {r#"
Invalid {} name prefix: '{}' does not match your username or any of your groups. Invalid {} name prefix: '{}' does not match your username or any of your groups.
Are you sure you are allowed to create {} names with this prefix? Are you sure you are allowed to create {} names with this prefix?
The format should be: <prefix>_<{} name>
Allowed prefixes: Allowed prefixes:
- {} - {}
@ -84,6 +85,7 @@ impl OwnerValidationError {
db_or_user.lowercased(), db_or_user.lowercased(),
name, name,
db_or_user.lowercased(), db_or_user.lowercased(),
db_or_user.lowercased(),
user.as_ref() user.as_ref()
.map(|u| u.username.clone()) .map(|u| u.username.clone())
.unwrap_or("???".to_string()), .unwrap_or("???".to_string()),

View File

@ -45,7 +45,7 @@ pub fn validate_ownership_by_prefixes(
if prefixes if prefixes
.iter() .iter()
.filter(|p| name.starts_with(*p)) .filter(|p| name.starts_with(&(p.to_string() + "_")))
.collect::<Vec<_>>() .collect::<Vec<_>>()
.is_empty() .is_empty()
{ {