mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
sanitize index values
This commit is contained in:
parent
b22695587d
commit
d0d469ee78
2 changed files with 8 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ tokio = { version = "1.45", features = ["full"] }
|
||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
url = "2.5"
|
url = "2.5"
|
||||||
urlencoding = "2.1"
|
urlencoding = "2.1"
|
||||||
|
voca_rs = "1.15"
|
||||||
walkdir = "2.5"
|
walkdir = "2.5"
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
librqbit = { git = "https://github.com/ikatson/rqbit.git", package = "librqbit" }
|
librqbit = { git = "https://github.com/ikatson/rqbit.git", package = "librqbit" }
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,15 @@ impl Value {
|
||||||
fn filter_name(value: Option<String>) -> Option<String> {
|
fn filter_name(value: Option<String>) -> Option<String> {
|
||||||
value.map(|v| {
|
value.map(|v| {
|
||||||
if v.len() > NAME_MAX_LEN {
|
if v.len() > NAME_MAX_LEN {
|
||||||
format!("{}...", &v[..NAME_MAX_LEN])
|
format!("{}...", sanitize(&v[..NAME_MAX_LEN]))
|
||||||
} else {
|
} else {
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Strip tags & bom chars from string
|
||||||
|
fn sanitize(value: &str) -> String {
|
||||||
|
use voca_rs::strip::*;
|
||||||
|
strip_tags(&strip_bom(value))
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue