diff --git a/vrsjmp/src-tauri/src/main.rs b/vrsjmp/src-tauri/src/main.rs index 8d18c3f..9a2df37 100644 --- a/vrsjmp/src-tauri/src/main.rs +++ b/vrsjmp/src-tauri/src/main.rs @@ -106,15 +106,19 @@ impl Client { fn set_query(query: &str, state: tauri::State) -> Vec { let mut matcher = state.matcher.lock().unwrap(); + // TODO: Contents of `query` should be escaped + let request = match Form::from_expr(&format!("(begin (bind_srv :vrsjmp) (get_items \"{}\"))", query)) { + Ok(f) => f, + Err(lyric::Error::IncompleteExpression(_)) => return vec![], + Err(e) => { + error!("Invalid form for user query - {e}"); + return vec![]; + } + }; + let response = state .client - .request( - Form::from_expr(&format!( - "(begin (bind_srv :vrsjmp) (get_items \"{}\"))", - query - )) - .unwrap(), - ) + .request(request) .unwrap(); let items = match response.contents.unwrap() {