Bug fixes round 3 (#298)

* fixed bugs

* title case

* bugs; ioerror

* reset breadcrumbs

* more fixes

* more fixes

* scrolling bug

* more fixes

* more fixes

* clippy

* canonicalize fix

* fixed requested changes

* removed debouncer update
This commit is contained in:
Wyatt Verchere
2023-07-19 14:13:25 -07:00
committed by GitHub
parent 6650cc9ce4
commit 1f478ec9fc
34 changed files with 932 additions and 602 deletions

View File

@@ -5,6 +5,7 @@ use crate::state::Profile;
use crate::util::fetch::{
fetch_json, write_cached_icon, FetchSemaphore, IoSemaphore,
};
use crate::util::io::IOError;
use async_zip::tokio::read::fs::ZipFileReader;
use chrono::{DateTime, Utc};
use reqwest::Method;
@@ -252,7 +253,7 @@ async fn read_icon_from_file(
Ok(None)
}
#[tracing::instrument(skip(profile, io_semaphore, fetch_semaphore))]
#[tracing::instrument(skip(paths, profile, io_semaphore, fetch_semaphore))]
#[theseus_macros::debug_pin]
pub async fn infer_data_from_files(
profile: Profile,
@@ -265,10 +266,12 @@ pub async fn infer_data_from_files(
// TODO: Make this concurrent and use progressive hashing to avoid loading each JAR in memory
for path in paths {
let mut file = tokio::fs::File::open(path.clone()).await?;
let mut file = tokio::fs::File::open(path.clone())
.await
.map_err(|e| IOError::with_path(e, &path))?;
let mut buffer = Vec::new();
file.read_to_end(&mut buffer).await?;
file.read_to_end(&mut buffer).await.map_err(IOError::from)?;
let hash = format!("{:x}", sha2::Sha512::digest(&buffer));
file_path_hashes.insert(hash, path.clone());