mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
cargo: bump async_zip from 0.0.9 to 0.0.11
Bumps [async_zip](https://github.com/Majored/rs-async-zip) from 0.0.9 to 0.0.11. - [Release notes](https://github.com/Majored/rs-async-zip/releases) - [Commits](https://github.com/Majored/rs-async-zip/compare/v0.0.9...v0.0.11) --- updated-dependencies: - dependency-name: async_zip dependency-type: direct:production update-type: version-update:semver-patch ...
This commit is contained in:
17
Cargo.lock
generated
17
Cargo.lock
generated
@@ -270,25 +270,16 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "async_io_utilities"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9b20cffc5590f4bf33f05f97a3ea587feba9c50d20325b401daa096b92ff7da0"
|
|
||||||
dependencies = [
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async_zip"
|
name = "async_zip"
|
||||||
version = "0.0.9"
|
version = "0.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a36d43bdefc7215b2b3a97edd03b1553b7969ad76551025eedd3b913c645f6e"
|
checksum = "c50d29ab7e2f9e808cca1a69ea56a36f4ff216f54a41a23aae1fd4afc05cc020"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-compression",
|
"async-compression",
|
||||||
"async_io_utilities",
|
|
||||||
"chrono",
|
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
|
"log",
|
||||||
|
"pin-project",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ async-channel = "1.8.0"
|
|||||||
async-imap = { git = "https://github.com/async-email/async-imap", branch = "master", default-features = false, features = ["runtime-tokio"] }
|
async-imap = { git = "https://github.com/async-email/async-imap", branch = "master", default-features = false, features = ["runtime-tokio"] }
|
||||||
async-native-tls = { version = "0.5", default-features = false, features = ["runtime-tokio"] }
|
async-native-tls = { version = "0.5", default-features = false, features = ["runtime-tokio"] }
|
||||||
async-smtp = { version = "0.9", default-features = false, features = ["runtime-tokio"] }
|
async-smtp = { version = "0.9", default-features = false, features = ["runtime-tokio"] }
|
||||||
async_zip = { version = "0.0.9", default-features = false, features = ["deflate"] }
|
async_zip = { version = "0.0.11", default-features = false, features = ["deflate", "fs"] }
|
||||||
backtrace = "0.3"
|
backtrace = "0.3"
|
||||||
base64 = "0.21"
|
base64 = "0.21"
|
||||||
bitflags = "1.3"
|
bitflags = "1.3"
|
||||||
|
|||||||
@@ -165,6 +165,19 @@ pub(crate) struct StatusUpdateItemAndSerial {
|
|||||||
max_serial: StatusUpdateSerial,
|
max_serial: StatusUpdateSerial,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns an entry index and a reference.
|
||||||
|
fn find_zip_entry<'a>(
|
||||||
|
file: &'a async_zip::ZipFile,
|
||||||
|
name: &str,
|
||||||
|
) -> Option<(usize, &'a async_zip::StoredZipEntry)> {
|
||||||
|
for (i, ent) in file.entries().iter().enumerate() {
|
||||||
|
if ent.entry().filename() == name {
|
||||||
|
return Some((i, ent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
impl Context {
|
impl Context {
|
||||||
/// check if a file is an acceptable webxdc for sending or receiving.
|
/// check if a file is an acceptable webxdc for sending or receiving.
|
||||||
pub(crate) async fn is_webxdc_file(&self, filename: &str, file: &[u8]) -> Result<bool> {
|
pub(crate) async fn is_webxdc_file(&self, filename: &str, file: &[u8]) -> Result<bool> {
|
||||||
@@ -180,7 +193,7 @@ impl Context {
|
|||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let archive = match async_zip::read::mem::ZipFileReader::new(file).await {
|
let archive = match async_zip::read::mem::ZipFileReader::new(file.to_vec()).await {
|
||||||
Ok(archive) => archive,
|
Ok(archive) => archive,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
info!(self, "{} cannot be opened as zip-file", &filename);
|
info!(self, "{} cannot be opened as zip-file", &filename);
|
||||||
@@ -188,7 +201,7 @@ impl Context {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if archive.entry("index.html").is_none() {
|
if find_zip_entry(archive.file(), "index.html").is_none() {
|
||||||
info!(self, "{} misses index.html", &filename);
|
info!(self, "{} misses index.html", &filename);
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
@@ -215,7 +228,7 @@ impl Context {
|
|||||||
|
|
||||||
let valid = match async_zip::read::fs::ZipFileReader::new(path).await {
|
let valid = match async_zip::read::fs::ZipFileReader::new(path).await {
|
||||||
Ok(archive) => {
|
Ok(archive) => {
|
||||||
if archive.entry("index.html").is_none() {
|
if find_zip_entry(archive.file(), "index.html").is_none() {
|
||||||
info!(self, "{} misses index.html", filename);
|
info!(self, "{} misses index.html", filename);
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
@@ -649,10 +662,9 @@ fn parse_webxdc_manifest(bytes: &[u8]) -> Result<WebxdcManifest> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn get_blob(archive: &mut async_zip::read::fs::ZipFileReader, name: &str) -> Result<Vec<u8>> {
|
async fn get_blob(archive: &mut async_zip::read::fs::ZipFileReader, name: &str) -> Result<Vec<u8>> {
|
||||||
let (i, _) = archive
|
let (i, _) = find_zip_entry(archive.file(), name)
|
||||||
.entry(name)
|
|
||||||
.ok_or_else(|| anyhow!("no entry found for {}", name))?;
|
.ok_or_else(|| anyhow!("no entry found for {}", name))?;
|
||||||
let mut reader = archive.entry_reader(i).await?;
|
let mut reader = archive.entry(i).await?;
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
reader.read_to_end(&mut buf).await?;
|
reader.read_to_end(&mut buf).await?;
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
@@ -754,9 +766,9 @@ impl Message {
|
|||||||
} else {
|
} else {
|
||||||
self.get_filename().unwrap_or_default()
|
self.get_filename().unwrap_or_default()
|
||||||
},
|
},
|
||||||
icon: if archive.entry("icon.png").is_some() {
|
icon: if find_zip_entry(archive.file(), "icon.png").is_some() {
|
||||||
"icon.png".to_string()
|
"icon.png".to_string()
|
||||||
} else if archive.entry("icon.jpg").is_some() {
|
} else if find_zip_entry(archive.file(), "icon.jpg").is_some() {
|
||||||
"icon.jpg".to_string()
|
"icon.jpg".to_string()
|
||||||
} else {
|
} else {
|
||||||
WEBXDC_DEFAULT_ICON.to_string()
|
WEBXDC_DEFAULT_ICON.to_string()
|
||||||
|
|||||||
Reference in New Issue
Block a user