mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-21 22:27:08 +00:00
Escape backslashes in fuzzy_search (#4462)
* Escape backslashes in fuzzy_search * Update utils.rs
This commit is contained in:
parent
ae62ef2b7e
commit
d79502dff3
|
@ -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}%")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue