mirror of https://github.com/tauri-apps/tauri
fix(core): isolation pattern breaks raw postMessage payload (#10841)
This commit is contained in:
parent
5048a7293b
commit
79de4332b6
|
@ -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,
|
HeaderValue, Method, Request, StatusCode,
|
||||||
};
|
};
|
||||||
|
use mime::APPLICATION_OCTET_STREAM;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use super::{CallbackFn, InvokeResponse};
|
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())
|
serde_json::from_str::<IsolationMessage<'_>>(request.body())
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
.and_then(|message| {
|
.and_then(|message| {
|
||||||
|
let is_raw = message.payload.content_type() == &APPLICATION_OCTET_STREAM.to_string();
|
||||||
|
let payload = crypto_keys.decrypt(message.payload)?;
|
||||||
Ok(Message {
|
Ok(Message {
|
||||||
cmd: message.cmd,
|
cmd: message.cmd,
|
||||||
callback: message.callback,
|
callback: message.callback,
|
||||||
error: message.error,
|
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,
|
options: message.options,
|
||||||
invoke_key: message.invoke_key,
|
invoke_key: message.invoke_key,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue