mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 00:46:30 +03:00
Fix(jsonrpc): Do not error on missign webxdc info (#6866)
When an invalid webxdc is set as draft, json-rpc's `get_draft` fails, because `get_webxdc_info` which it calls, fails because the zip reader can not read a non-zip file. With this change, any error occurring in `get_webxdc_info` is ignored and the None-variant is returned instead. I also added a test, that setting invalid xdcs is draft is fine core-wise and checked that the input field stays responsive when a fake.xdc produced like in #6826 is added to draft close #6826
This commit is contained in:
@@ -124,6 +124,23 @@ async fn test_send_invalid_webxdc() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_set_draft_invalid_webxdc() -> Result<()> {
|
||||
let t = TestContext::new_alice().await;
|
||||
let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?;
|
||||
|
||||
let mut instance = create_webxdc_instance(
|
||||
&t,
|
||||
"invalid-no-zip-but-7z.xdc",
|
||||
include_bytes!("../../test-data/webxdc/invalid-no-zip-but-7z.xdc"),
|
||||
)?;
|
||||
|
||||
// draft should not fail
|
||||
chat_id.set_draft(&t, Some(&mut instance)).await?;
|
||||
chat_id.get_draft(&t).await.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_send_special_webxdc_format() -> Result<()> {
|
||||
let t = TestContext::new_alice().await;
|
||||
|
||||
Reference in New Issue
Block a user