fix: chunithm crashing with mempatcher

This commit is contained in:
2025-04-20 06:37:46 +00:00
parent 69f2c83109
commit 2aff5834b9
5 changed files with 47 additions and 23 deletions

View File

@ -30,20 +30,21 @@ impl PatchFileVec {
pub fn find_patches(&self, target: impl AsRef<Path>) -> Result<Vec<Patch>> {
let checksum = try_digest(target.as_ref())?;
let mut res = Vec::new();
let mut res_patches = Vec::new();
for pfile in &self.0 {
for plist in &pfile.0 {
log::debug!("checking {}", plist.sha256.to_ascii_lowercase());
if plist.sha256.to_ascii_lowercase() == checksum {
let this_hash = plist.sha256.to_ascii_lowercase();
log::debug!("checking {}", this_hash);
if this_hash == checksum {
let mut cloned = plist.clone().patches;
res.append(&mut cloned);
res_patches.append(&mut cloned);
}
}
}
if res.len() == 0 {
if res_patches.len() == 0 {
log::warn!("no matching patchset for {:?} ({})", target.as_ref(), checksum);
}
Ok(res)
Ok(res_patches)
}
}