Files
nixpkgs/pkgs/applications/misc/pagefind/lindera-dictionary-support-file-paths.patch
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

42 lines
1.5 KiB
Diff

diff --git a/src/assets.rs b/src/assets.rs
index 58afc4c..d5813e6 100644
--- a/src/assets.rs
+++ b/src/assets.rs
@@ -93,6 +93,28 @@ async fn download_with_retry(
for url in urls {
debug!("Attempting to download from {}", url);
+ if let Some(path) = url.strip_prefix("file://") {
+ let content = std::fs::read(path)?;
+
+ // Calculate MD5 hash
+ let mut context = Context::new();
+ context.consume(&content);
+ let actual_md5 = format!("{:x}", context.compute());
+ debug!("Expected MD5: {}", expected_md5);
+ debug!("Actual MD5: {}", actual_md5);
+
+ if actual_md5 == expected_md5 {
+ debug!("MD5 check passed from {}", url);
+ return Ok(content);
+ } else {
+ warn!(
+ "MD5 mismatch from {}! Expected {}, got {}",
+ url, expected_md5, actual_md5
+ );
+ // continue to next url
+ }
+ }
+ else {
match client.get(url).send().await {
Ok(resp) if resp.status().is_success() => {
debug!("HTTP download successful from {}", url);
@@ -127,6 +149,7 @@ async fn download_with_retry(
// continue to next url
}
}
+ }
}
sleep(Duration::from_secs(1)).await;