mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 08:41:00 +00:00
index UID format; fix #497
This commit is contained in:
committed by
Quentin de Quelen
parent
041eed2a06
commit
c5b6e641a4
@ -138,7 +138,13 @@ pub async fn create_index(mut ctx: Request<Data>) -> SResult<Response> {
|
||||
let db = &ctx.state().db;
|
||||
|
||||
let uid = match body.uid {
|
||||
Some(uid) => uid,
|
||||
Some(uid) => {
|
||||
if uid.chars().all(|x| x.is_ascii_alphanumeric() || x == '-' || x == '_') {
|
||||
uid
|
||||
} else {
|
||||
return Err(ResponseError::InvalidIndexUid)
|
||||
}
|
||||
},
|
||||
None => loop {
|
||||
let uid = generate_uid();
|
||||
if db.open_index(&uid).is_none() {
|
||||
|
Reference in New Issue
Block a user