sanitize index values

This commit is contained in:
yggverse 2025-07-09 01:37:37 +03:00
parent b22695587d
commit d0d469ee78
2 changed files with 8 additions and 1 deletions

View file

@ -21,6 +21,7 @@ tokio = { version = "1.45", features = ["full"] }
tracing-subscriber = "0.3"
url = "2.5"
urlencoding = "2.1"
voca_rs = "1.15"
walkdir = "2.5"
[patch.crates-io]
librqbit = { git = "https://github.com/ikatson/rqbit.git", package = "librqbit" }

View file

@ -35,9 +35,15 @@ impl Value {
fn filter_name(value: Option<String>) -> Option<String> {
value.map(|v| {
if v.len() > NAME_MAX_LEN {
format!("{}...", &v[..NAME_MAX_LEN])
format!("{}...", sanitize(&v[..NAME_MAX_LEN]))
} else {
v
}
})
}
/// Strip tags & bom chars from string
fn sanitize(value: &str) -> String {
use voca_rs::strip::*;
strip_tags(&strip_bom(value))
}