mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-24 04:03:52 +03:00
fix(core): isolation pattern breaks raw postMessage payload (#10841)
This commit is contained in:
parent
5048a7293b
commit
79de4332b6
5
.changes/fix-isolation-parse-raw-body.md
Normal file
5
.changes/fix-isolation-parse-raw-body.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch:bug
|
||||
---
|
||||
|
||||
Fixes IPC postMessage raw body processing when using the isolation pattern.
|
@ -17,6 +17,7 @@ use http::{
|
||||
},
|
||||
HeaderValue, Method, Request, StatusCode,
|
||||
};
|
||||
use mime::APPLICATION_OCTET_STREAM;
|
||||
use url::Url;
|
||||
|
||||
use super::{CallbackFn, InvokeResponse};
|
||||
@ -278,11 +279,17 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
|
||||
serde_json::from_str::<IsolationMessage<'_>>(request.body())
|
||||
.map_err(Into::into)
|
||||
.and_then(|message| {
|
||||
let is_raw = message.payload.content_type() == &APPLICATION_OCTET_STREAM.to_string();
|
||||
let payload = crypto_keys.decrypt(message.payload)?;
|
||||
Ok(Message {
|
||||
cmd: message.cmd,
|
||||
callback: message.callback,
|
||||
error: message.error,
|
||||
payload: serde_json::from_slice(&crypto_keys.decrypt(message.payload)?)?,
|
||||
payload: if is_raw {
|
||||
payload.into()
|
||||
} else {
|
||||
serde_json::from_slice(&payload)?
|
||||
},
|
||||
options: message.options,
|
||||
invoke_key: message.invoke_key,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user