Commit 706c897f7b

706c897f7bd47a8125b4ef9115380a60dd5944fd

parent: 772a217411

Unsigned

Siriusmart <71584876+Siriusmart@users.noreply.github.com> · 2023-05-29 09:09 UTC

fixed searchbar showing escape characters

Layout: unified · split

docs/src/changelogs.md +1 −1
@@ -9,7 +9,7 @@
99
1010### Fixed
1111
12- I remember fixing something but forgot what it was D:
12- Search url not escaped, so searches with symbols or spaces are not working.
1313
1414### v0.7.1
1515
src/config/search.rs +2 −1
@@ -1,6 +1,7 @@
11use crate::global::{structs::Message, traits::*};
22use serde::{Deserialize, Serialize};
33use typemap::Key;
4use urlencoding::encode;
45
56// can be turned into URL Params for the search term with filters
67/// Search query & filters
@@ -34,7 +35,7 @@ impl ToString for Search {
3435 format!(
3536 "{}&page={}",
3637 vec![
37 format!("q={}", self.query),
38 format!("q={}", encode(&self.query)),
3839 self.filters.sort.as_url_string(),
3940 self.filters.date.as_url_string(),
4041 self.filters.duration.as_url_string(),
src/items/searchbar.rs +1 −2
@@ -12,7 +12,6 @@ use tui::{
1212 widgets::{Block, Borders},
1313};
1414use tui_additions::{framework::FrameworkItem, widgets::TextField};
15use urlencoding::encode;
1615
1716/// the search bar item
1817#[derive(Clone, Default)]
@@ -138,7 +137,7 @@ impl FrameworkItem for SearchBar {
138137 }
139138
140139 let mut search = framework.data.state.get_mut::<Search>().unwrap();
141 search.query = encode(&self.text_field.content).into_owned();
140 search.query = self.text_field.content.clone();
142141 let search = search.clone();
143142 let tasks = framework.data.state.get_mut::<Tasks>().unwrap();
144143 tasks.priority.push(Task::LoadPage(Page::Search(search)));