mirror of
https://github.com/Drop-OSS/droplet.git
synced 2025-11-10 04:22:16 +10:00
Bump rawzip to 0.3
No need for any patches ;)
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -629,7 +629,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rawzip"
|
name = "rawzip"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e512201a808c46ad2a0c810057db306d66b58d5516304548d2445a53db933499"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rcgen"
|
name = "rcgen"
|
||||||
|
|||||||
@ -24,14 +24,11 @@ webpki = "0.22.4"
|
|||||||
ring = "0.17.14"
|
ring = "0.17.14"
|
||||||
tokio = { version = "1.45.1", features = ["fs", "io-util"] }
|
tokio = { version = "1.45.1", features = ["fs", "io-util"] }
|
||||||
tokio-util = { version = "0.7.15", features = ["codec"] }
|
tokio-util = { version = "0.7.15", features = ["codec"] }
|
||||||
rawzip = "0.2.0"
|
rawzip = "0.3.0"
|
||||||
|
|
||||||
[package.metadata.patch]
|
[package.metadata.patch]
|
||||||
crates = ["rawzip"]
|
crates = ["rawzip"]
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
rawzip = { path="./target/patch/rawzip-0.2.0" }
|
|
||||||
|
|
||||||
[dependencies.x509-parser]
|
[dependencies.x509-parser]
|
||||||
version = "0.17.0"
|
version = "0.17.0"
|
||||||
features = ["verify"]
|
features = ["verify"]
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
diff --git a/src/archive.rs b/src/archive.rs
|
|
||||||
index 1203015..837c405 100644
|
|
||||||
--- a/src/archive.rs
|
|
||||||
+++ b/src/archive.rs
|
|
||||||
@@ -275,7 +275,7 @@ impl<'data> Iterator for ZipSliceEntries<'data> {
|
|
||||||
/// ```
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct ZipArchive<R> {
|
|
||||||
- pub(crate) reader: R,
|
|
||||||
+ pub reader: R,
|
|
||||||
pub(crate) comment: ZipString,
|
|
||||||
pub(crate) eocd: EndOfCentralDirectory,
|
|
||||||
}
|
|
||||||
@@ -431,9 +431,9 @@ where
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct ZipEntry<'archive, R> {
|
|
||||||
archive: &'archive ZipArchive<R>,
|
|
||||||
- body_offset: u64,
|
|
||||||
- body_end_offset: u64,
|
|
||||||
- entry: ZipArchiveEntryWayfinder,
|
|
||||||
+ pub body_offset: u64,
|
|
||||||
+ pub body_end_offset: u64,
|
|
||||||
+ pub entry: ZipArchiveEntryWayfinder,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'archive, R> ZipEntry<'archive, R>
|
|
||||||
@ -75,12 +75,17 @@ impl ZipVersionBackend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_entry(&self, entry: ZipEntry<'_, FileReader>) -> ZipFileWrapper {
|
pub fn new_entry(
|
||||||
|
&self,
|
||||||
|
entry: ZipEntry<'_, FileReader>,
|
||||||
|
wayfinder: ZipArchiveEntryWayfinder,
|
||||||
|
) -> ZipFileWrapper {
|
||||||
|
let (offset, end_offset) = entry.compressed_data_range();
|
||||||
ZipFileWrapper {
|
ZipFileWrapper {
|
||||||
archive: self.archive.clone(),
|
archive: self.archive.clone(),
|
||||||
wayfinder: entry.entry,
|
wayfinder,
|
||||||
offset: entry.body_offset,
|
offset,
|
||||||
end_offset: entry.body_end_offset,
|
end_offset,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +102,7 @@ impl Read for ZipFileWrapper {
|
|||||||
let read_size = buf.len().min((self.end_offset - self.offset) as usize);
|
let read_size = buf.len().min((self.end_offset - self.offset) as usize);
|
||||||
let read = self
|
let read = self
|
||||||
.archive
|
.archive
|
||||||
.reader
|
.get_ref()
|
||||||
.read_at(&mut buf[..read_size], self.offset)?;
|
.read_at(&mut buf[..read_size], self.offset)?;
|
||||||
self.offset += read as u64;
|
self.offset += read as u64;
|
||||||
Ok(read)
|
Ok(read)
|
||||||
@ -120,8 +125,8 @@ impl VersionBackend for ZipVersionBackend {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
results.push(VersionFile {
|
results.push(VersionFile {
|
||||||
relative_filename: entry.file_safe_path().unwrap().to_string(),
|
relative_filename: String::from(entry.file_path().try_normalize().unwrap()),
|
||||||
permission: 744, // apparently ZIPs with permissions are not supported by this library, so we let the owner do anything
|
permission: entry.mode().permissions(),
|
||||||
size: entry.uncompressed_size_hint(),
|
size: entry.uncompressed_size_hint(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -133,7 +138,7 @@ impl VersionBackend for ZipVersionBackend {
|
|||||||
let mut entries = self.archive.entries(read_buffer);
|
let mut entries = self.archive.entries(read_buffer);
|
||||||
let entry = loop {
|
let entry = loop {
|
||||||
if let Some(v) = entries.next_entry().unwrap() {
|
if let Some(v) = entries.next_entry().unwrap() {
|
||||||
if v.file_safe_path().unwrap().to_string() == file.relative_filename {
|
if v.file_path().try_normalize().unwrap().as_ref() == &file.relative_filename {
|
||||||
break Some(v);
|
break Some(v);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -144,7 +149,7 @@ impl VersionBackend for ZipVersionBackend {
|
|||||||
let wayfinder = entry.wayfinder();
|
let wayfinder = entry.wayfinder();
|
||||||
let local_entry = self.archive.get_entry(wayfinder).unwrap();
|
let local_entry = self.archive.get_entry(wayfinder).unwrap();
|
||||||
|
|
||||||
let wrapper = self.new_entry(local_entry);
|
let wrapper = self.new_entry(local_entry, wayfinder);
|
||||||
|
|
||||||
Some(Box::new(wrapper))
|
Some(Box::new(wrapper))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user