Escape backslashes in fuzzy_search (#4462)

* Escape backslashes in fuzzy_search

* Update utils.rs
pull/4463/head
dullbananas 2024-02-18 07:12:56 -07:00 committed by GitHub
parent ae62ef2b7e
commit d79502dff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -236,7 +236,11 @@ impl<T: LimitDsl> LimitDsl for Commented<T> {
}
pub fn fuzzy_search(q: &str) -> String {
let replaced = q.replace('%', "\\%").replace('_', "\\_").replace(' ', "%");
let replaced = q
.replace('\\', "\\\\")
.replace('%', "\\%")
.replace('_', "\\_")
.replace(' ', "%");
format!("%{replaced}%")
}