Use a Regex in insta dynamic redaction to replace Uuids with [uuid]

(cherry picked from commit f8b8c6ab71a28052cf9b271ca8aa5d4175f9e8f9)
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
This commit is contained in:
Martin Tzvetanov Grigorov 2025-05-26 13:39:15 +03:00
parent 34d58f35c8
commit f54b57e5be
No known key found for this signature in database
GPG key ID: 3194FD8C1AE300EF
5 changed files with 1399 additions and 1281 deletions

View file

@ -64,7 +64,7 @@ pub enum MeilisearchHttpError {
#[error(transparent)]
IndexScheduler(#[from] index_scheduler::Error),
#[error("{}", match .index_name {
Some(name) if !name.is_empty() => format!("Index `{}`: {error}", MeilisearchHttpError::index_name(name)),
Some(name) if !name.is_empty() => format!("Index `{}`: {error}", name),
_ => format!("{error}")
})]
Milli { error: milli::Error, index_name: Option<String> },
@ -84,14 +84,6 @@ impl MeilisearchHttpError {
pub(crate) fn from_milli(error: milli::Error, index_name: Option<String>) -> Self {
Self::Milli { error, index_name }
}
fn index_name(index_name: &str) -> &str {
if let Ok(_) = uuid::Uuid::parse_str(index_name) {
"[uuid]"
} else {
index_name
}
}
}
impl ErrorCode for MeilisearchHttpError {