Skip to content

Commit

Permalink
Merge pull request #31 from tauri-apps/fix/percent-decode
Browse files Browse the repository at this point in the history
feat: tauri v2 support,  #24
  • Loading branch information
lucasfernog authored Sep 23, 2024
2 parents 77f0cf4 + 5c77fd4 commit 0cb0e12
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-parse-command-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-invoke-http": patch
---

Properly parse window label and command name on Android (percent encoding).
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ portpicker = "0.1"
serde_json = "1.0"
tokio = { version = "1", features = ["net"] }
log = "0.4"
percent-encoding = "2.3"
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use hyper::{
service::service_fn,
HeaderMap, Method, Request, Response, StatusCode,
};
use percent_encoding::percent_decode_str;
use tauri::{
http::HeaderName,
ipc::{CallbackFn, InvokeBody, InvokeResponse},
Expand Down Expand Up @@ -166,7 +167,7 @@ async fn handle_request<R: Runtime>(
let url = request.uri().to_string();
let pieces = url.split('/').collect::<Vec<_>>();
let window_label = pieces[1];
let cmd = pieces[2];
let cmd = percent_decode_str(pieces[2]).decode_utf8()?;

if let Some(window) = app.get_webview_window(window_label) {
let content_type = request
Expand Down

0 comments on commit 0cb0e12

Please sign in to comment.