Merge pull request #998 from AppFlowy-IO/feat/allow-underscore-in-url
feat: allow underscore in publish url
This commit is contained in:
commit
7c6a706bbd
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ async fn test_set_publish_namespace_set() {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
let new_namespace = uuid::Uuid::new_v4().to_string();
|
||||
let new_namespace = format!("namespace_{}", uuid::Uuid::new_v4());
|
||||
c.set_workspace_publish_namespace(&workspace_id.to_string(), new_namespace.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
@ -156,9 +156,9 @@ async fn test_publish_doc() {
|
|||
assert_eq!(err.code, ErrorCode::PublishNameTooLong, "{:?}", err);
|
||||
}
|
||||
|
||||
let publish_name_1 = "publish-name-1";
|
||||
let publish_name_1 = "publish_name-1";
|
||||
let view_id_1 = uuid::Uuid::new_v4();
|
||||
let publish_name_2 = "publish-name-2";
|
||||
let publish_name_2 = "publish_name-2";
|
||||
let view_id_2 = uuid::Uuid::new_v4();
|
||||
|
||||
// User publishes two collabs
|
||||
|
|
|
|||
Loading…
Reference in New Issue