Disk cache recognizes craft-atomic's staging names that keep the file extension; update prompt test reads next's dialog words

This commit is contained in:
aiongg committed 2026-11-24 01:39:31 +00:00
1 parent 2afa397987
commit ffbb1b3c56
2 files changed
+6 -2

No files matched your search

+4 -1
View File
@@ -238,10 +238,13 @@ fn digest_name(stem: &str) -> bool {
stem.len() == 64 && stem.bytes().all(|byte| byte.is_ascii_hexdigit())
}
/// craft-atomic's staging file of a cache file: `.{file}.{pid}-{n}.craft_tmp`, where `file` is the cache file's name or
/// its first part (older craft-atomic cut it to 64 characters).
fn staging_name(name: &str) -> bool {
let Some((stem, suffix)) = name.strip_prefix('.').and_then(|name| name.strip_suffix(".craft_tmp")).and_then(|name| name.split_once('.')) else {
let Some((file, suffix)) = name.strip_prefix('.').and_then(|name| name.strip_suffix(".craft_tmp")).and_then(|name| name.rsplit_once('.')) else {
return false;
};
let stem = file.split_once('.').map_or(file, |(stem, _)| stem);
digest_name(stem) && suffix.split_once('-').is_some_and(|(pid, counter)| pid.parse::<u32>().is_ok_and(|pid| pid > 0) && counter.parse::<u64>().is_ok())
}
+2 -1
View File
@@ -178,7 +178,8 @@ fn an_offered_release_opens_the_prompt_over_the_window() {
harness.run_steps(3);
let _ = harness.get_by_label("LATER");
let _ = harness.get_by_label("Update available");
let _ = harness.get_by_label("Later");
assert!(harness.state().updates_rt.updater.prompt_open());
}