pub struct ZipEntry {
pub name: String,
pub compressed_size: u64,
pub uncompressed_size: u64,
pub compression_method: u16,
pub offset: u64,
pub crc32: u32,
pub is_encrypted: bool,
}Expand description
Entry in a ZIP central directory.
Shared between the sync (reader) and async (async_reader) modules.
Fields§
§name: String§compressed_size: u64§uncompressed_size: u64§compression_method: u16§offset: u64Offset of the local file header from the start of the archive.
crc32: u32CRC-32 checksum from the central directory.
is_encrypted: booltrue when general-purpose bit 0 (encryption flag) is set in the
central directory. The sync reader gates this behind
#[cfg(feature = "encryption")] at the usage sites; the async reader
always exposes it.
Implementations§
Source§impl ZipEntry
impl ZipEntry
Sourcepub fn safe_path(&self) -> PathBuf
pub fn safe_path(&self) -> PathBuf
Return a sanitized extraction path safe against zip-slip attacks.
Strips leading /, \, .., and Windows drive prefixes.
Always use this method when extracting entries to disk. Never use
entry.name directly as a filesystem path.
§Example
// A malicious entry "../../../etc/passwd" becomes "etc/passwd"Trait Implementations§
Auto Trait Implementations§
impl Freeze for ZipEntry
impl RefUnwindSafe for ZipEntry
impl Send for ZipEntry
impl Sync for ZipEntry
impl Unpin for ZipEntry
impl UnsafeUnpin for ZipEntry
impl UnwindSafe for ZipEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more