mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
Do not read whole webxdc file into memory
This seems not only wasteful but genuinly has the risk someone makes their device useless by accidentally adding a huge file. This also re-structures the checks a little: The if-conditions are flattened out and cheap checks are done before more expensive ones.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::future::Future;
|
||||
use std::io::Cursor;
|
||||
use std::pin::Pin;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
@@ -1020,8 +1021,9 @@ impl MimeMessage {
|
||||
if decoded_data.is_empty() {
|
||||
return;
|
||||
}
|
||||
let reader = Cursor::new(decoded_data);
|
||||
let msg_type = if context
|
||||
.is_webxdc_file(filename, decoded_data)
|
||||
.is_webxdc_file(filename, reader)
|
||||
.await
|
||||
.unwrap_or(false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user