From db2e73aa8ea36bb3b82d9d75773d460813b8116d Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Mon, 9 Aug 2021 11:10:57 -0600 Subject: [PATCH] Skip unrar extract errors, update compress-tools --- Cargo.lock | 5 +++-- Cargo.toml | 3 +-- src/main.rs | 21 +++++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be1b47f..ebbb1a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -199,8 +199,9 @@ dependencies = [ [[package]] name = "compress-tools" -version = "0.11.2" -source = "git+https://github.com/OSSystems/compress-tools-rs.git?branch=issue-59#821d400a5c9e526489e37d7252a427ec756296c5" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef528870e8a8f354a5a86805dcc472687d0a636874eb5eecc9ef9e0eeba149e" dependencies = [ "derive_more", "libc", diff --git a/Cargo.toml b/Cargo.toml index 7a08feb..0557aad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,7 @@ description = "Saves Skyrim mod cell edits to a database" anyhow = "1.0" argh = "0.1" chrono = { version = "0.4", features = ["serde"] } -# Need specific branch to fix my issue with bad-encoding in some archive file names: https://github.com/OSSystems/compress-tools-rs/issues/59 -compress-tools = { git = "https://github.com/OSSystems/compress-tools-rs.git", branch = "issue-59" } +compress-tools = "0.12" dotenv = "0.15" futures = "0.3" infer = { version = "0.4", default-features = false } diff --git a/src/main.rs b/src/main.rs index 1780b3b..b493de9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,10 +153,23 @@ async fn extract_with_unrar( info!("uncompressing downloaded archive"); let extract = Archive::new(&temp_file_path.to_string_lossy().to_string())? .extract_to(temp_dir.path().to_string_lossy().to_string()); - extract - .expect("failed to extract") - .process() - .expect("failed to extract"); + + let mut extract = match extract { + Err(err) => { + warn!(error = %err, "failed to extract with unrar"); + file::update_unable_to_extract_plugins(&pool, db_file.id, true).await?; + return Ok(()) + } + Ok(extract) => extract + }; + match extract.process() { + Err(err) => { + warn!(error = %err, "failed to extract with unrar"); + file::update_unable_to_extract_plugins(&pool, db_file.id, true).await?; + return Ok(()) + } + _ => {} + } for file_path in plugin_file_paths.iter() { info!(