From 187cadaa01c47f87ac61c05b40e12e15cd6a93e9 Mon Sep 17 00:00:00 2001 From: Zack Fu Zi Xiang Date: Fri, 15 Nov 2024 15:45:36 +0800 Subject: [PATCH] feat: allow underscore in publish url --- src/biz/workspace/publish.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/biz/workspace/publish.rs b/src/biz/workspace/publish.rs index e2c2d26f..61d78df7 100644 --- a/src/biz/workspace/publish.rs +++ b/src/biz/workspace/publish.rs @@ -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 }); } }