mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-04-01 01:25:36 +00:00
sanitize index values
This commit is contained in:
parent
b22695587d
commit
d0d469ee78
2 changed files with 8 additions and 1 deletions
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue