feat: allow underscore in publish url

This commit is contained in:
Zack Fu Zi Xiang 2024-11-15 15:45:36 +08:00
parent d0c212ff10
commit 187cadaa01
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -74,7 +74,7 @@ fn check_collab_publish_name(publish_name: &str) -> Result<(), AppError> {
// Only contain alphanumeric characters and hyphens
for c in publish_name.chars() {
if !c.is_alphanumeric() && c != '-' {
if !c.is_alphanumeric() && c != '-' && c != '_' {
return Err(AppError::PublishNameInvalidCharacter { character: c });
}
}
@ -246,8 +246,9 @@ pub async fn list_collab_publish_info(
async fn check_workspace_namespace(new_namespace: &str) -> Result<(), AppError> {
// Must be url safe
// Only contain alphanumeric characters and hyphens
// and underscores (discouraged)
for c in new_namespace.chars() {
if !c.is_alphanumeric() && c != '-' {
if !c.is_alphanumeric() && c != '-' && c != '_' {
return Err(AppError::CustomNamespaceInvalidCharacter { character: c });
}
}