Update packages, fix unrar after major version upgrade
This commit is contained in:
1549
Cargo.lock
generated
1549
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
@@ -21,7 +21,13 @@ scraper = "0.16"
|
|||||||
seahash = "4.1"
|
seahash = "4.1"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
sqlx = { version = "0.7", features = ["runtime-tokio-native-tls", "postgres", "migrate", "chrono", "json"] }
|
sqlx = { version = "0.7", features = [
|
||||||
|
"runtime-tokio-native-tls",
|
||||||
|
"postgres",
|
||||||
|
"migrate",
|
||||||
|
"chrono",
|
||||||
|
"json",
|
||||||
|
] }
|
||||||
skyrim-cell-dump = "0.4"
|
skyrim-cell-dump = "0.4"
|
||||||
tempfile = "3.5"
|
tempfile = "3.5"
|
||||||
tokio = { version = "1.34", features = ["full"] }
|
tokio = { version = "1.34", features = ["full"] }
|
||||||
@@ -30,6 +36,6 @@ tracing = "0.1"
|
|||||||
tracing-appender = "0.2"
|
tracing-appender = "0.2"
|
||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
# Need this unicode fix: https://github.com/muja/unrar.rs/commit/3af9a6015dc89c1329a2fe5d6f4a7f69ded8ba1d
|
# Need this unicode fix: https://github.com/muja/unrar.rs/commit/3af9a6015dc89c1329a2fe5d6f4a7f69ded8ba1d
|
||||||
unrar = { git = "https://github.com/muja/unrar.rs.git" }
|
unrar = "0.5"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
zip = "0.6"
|
zip = "0.6"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub async fn extract_with_unrar(
|
|||||||
std::io::copy(file, &mut temp_file)?;
|
std::io::copy(file, &mut temp_file)?;
|
||||||
|
|
||||||
let mut plugin_file_paths = Vec::new();
|
let mut plugin_file_paths = Vec::new();
|
||||||
let list = Archive::new(&temp_file_path.to_string_lossy().to_string())?.list();
|
let list = Archive::new(&temp_file_path.to_string_lossy().to_string()).open_for_listing();
|
||||||
match list {
|
match list {
|
||||||
Ok(list) => {
|
Ok(list) => {
|
||||||
for entry in list.flatten() {
|
for entry in list.flatten() {
|
||||||
@@ -52,21 +52,37 @@ pub async fn extract_with_unrar(
|
|||||||
|
|
||||||
if !plugin_file_paths.is_empty() {
|
if !plugin_file_paths.is_empty() {
|
||||||
info!("uncompressing downloaded archive");
|
info!("uncompressing downloaded archive");
|
||||||
let extract = Archive::new(&temp_file_path.to_string_lossy().to_string())?
|
match Archive::new(&temp_file_path.to_string_lossy().to_string())
|
||||||
.extract_to(temp_dir.path().to_string_lossy().to_string());
|
.open_for_processing() {
|
||||||
|
Ok(archive) => {
|
||||||
let mut extract = match extract {
|
match archive.read_header() {
|
||||||
|
Ok(Some(archive)) => {
|
||||||
|
match archive.extract_to(temp_dir.path().to_string_lossy().to_string()) {
|
||||||
|
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) => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
warn!("failed to extract with unrar: no header found");
|
||||||
|
file::update_unable_to_extract_plugins(pool, db_file.id, true).await?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
warn!(error = %err, "failed to extract with unrar");
|
||||||
|
file::update_unable_to_extract_plugins(pool, db_file.id, true).await?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(error = %err, "failed to extract with unrar");
|
warn!(error = %err, "failed to extract with unrar");
|
||||||
file::update_unable_to_extract_plugins(pool, db_file.id, true).await?;
|
file::update_unable_to_extract_plugins(pool, db_file.id, true).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Ok(extract) => extract,
|
|
||||||
};
|
|
||||||
if let Err(err) = extract.process() {
|
|
||||||
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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user