From 7be069e965b87e87a804271b169ae22282a9c66b Mon Sep 17 00:00:00 2001 From: Pakin Date: Mon, 8 Sep 2025 11:25:46 +0700 Subject: [PATCH] try fix by gz decoder --- Cargo.lock | 1 + Cargo.toml | 1 + src/firmware/xbuilder.rs | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 436308f..2fbddb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,6 +426,7 @@ name = "libtbr" version = "0.1.1" dependencies = [ "chrono", + "flate2", "log", "mlua", "rand", diff --git a/Cargo.toml b/Cargo.toml index 7f71ead..803e2a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ edition = "2024" [dependencies] chrono = "0.4.41" +flate2 = "1.1.2" log = "0.4.27" mlua = { version = "0.11.3", features = ["lua54"] } rand = "0.9.2" diff --git a/src/firmware/xbuilder.rs b/src/firmware/xbuilder.rs index 2b22860..28cb753 100644 --- a/src/firmware/xbuilder.rs +++ b/src/firmware/xbuilder.rs @@ -28,10 +28,11 @@ impl Peekable for LastBuildFirmware { let mut peeked = Vec::new(); let file = File::open(self.path.clone()).unwrap(); - let mut ar = Archive::new(file); + let decompressed = flate2::read::GzDecoder::new(file); + let mut ar = Archive::new(decompressed); for file2 in ar.entries().unwrap() { - let f = unsafe { file2.unwrap_unchecked() }; + let f = file2.unwrap(); peeked.push( f.path() .unwrap()