diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b3442d1c..354e4125 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -575,6 +575,7 @@ dependencies = [ "once_cell", "open 5.0.1", "parking_lot", + "percent-encoding", "port_scanner", "reqwest", "rquickjs", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 70919be7..10ad4b89 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -40,6 +40,7 @@ reqwest = { version = "0.11", features = ["json", "rustls-tls"] } tauri = { version = "1.5", features = ["clipboard-all", "global-shortcut-all", "process-all", "shell-all", "system-tray", "updater", "window-all"] } window-vibrancy = { version = "0.4.3" } window-shadows = { version = "0.2" } +percent-encoding = "2.3.1" [target.'cfg(windows)'.dependencies] diff --git a/src-tauri/src/config/prfitem.rs b/src-tauri/src/config/prfitem.rs index 86866e02..ef97582a 100644 --- a/src-tauri/src/config/prfitem.rs +++ b/src-tauri/src/config/prfitem.rs @@ -263,7 +263,17 @@ impl PrfItem { let filename = match header.get("Content-Disposition") { Some(value) => { let filename = value.to_str().unwrap_or(""); - help::parse_str::(filename, "filename=") + match help::parse_str::(filename, "filename=") { + Some(filename) => Some(filename), + None => match help::parse_str::(filename, "filename*=") { + Some(filename) => { + let iter = percent_encoding::percent_decode(filename.as_bytes()); + let filename = iter.decode_utf8().unwrap_or_default(); + filename.split("''").last().map(|s| s.to_string()) + } + None => None, + }, + } } None => None, };