Skip unrar extract errors, update compress-tools

This commit is contained in:
Tyler Hallada 2021-08-09 11:10:57 -06:00
parent 6136ac18fa
commit db2e73aa8e
3 changed files with 21 additions and 8 deletions

5
Cargo.lock generated
View File

@ -199,8 +199,9 @@ dependencies = [
[[package]] [[package]]
name = "compress-tools" name = "compress-tools"
version = "0.11.2" version = "0.12.0"
source = "git+https://github.com/OSSystems/compress-tools-rs.git?branch=issue-59#821d400a5c9e526489e37d7252a427ec756296c5" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ef528870e8a8f354a5a86805dcc472687d0a636874eb5eecc9ef9e0eeba149e"
dependencies = [ dependencies = [
"derive_more", "derive_more",
"libc", "libc",

View File

@ -11,8 +11,7 @@ description = "Saves Skyrim mod cell edits to a database"
anyhow = "1.0" anyhow = "1.0"
argh = "0.1" argh = "0.1"
chrono = { version = "0.4", features = ["serde"] } 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 = "0.12"
compress-tools = { git = "https://github.com/OSSystems/compress-tools-rs.git", branch = "issue-59" }
dotenv = "0.15" dotenv = "0.15"
futures = "0.3" futures = "0.3"
infer = { version = "0.4", default-features = false } infer = { version = "0.4", default-features = false }

View File

@ -153,10 +153,23 @@ async fn extract_with_unrar(
info!("uncompressing downloaded archive"); info!("uncompressing downloaded archive");
let extract = Archive::new(&temp_file_path.to_string_lossy().to_string())? let extract = Archive::new(&temp_file_path.to_string_lossy().to_string())?
.extract_to(temp_dir.path().to_string_lossy().to_string()); .extract_to(temp_dir.path().to_string_lossy().to_string());
extract
.expect("failed to extract") let mut extract = match extract {
.process() Err(err) => {
.expect("failed to extract"); 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() { for file_path in plugin_file_paths.iter() {
info!( info!(