fix(scan): uploads carry their sha256, so change detection compares the bytes (#531)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Canceled after 0s
CI / Deploy Agent (push) Canceled after 0s
CI / Deploy Dashboard (push) Successful in 5m32s

This commit was merged in pull request #531.
This commit is contained in:
sharang committed 2026-10-08 21:45:32 +00:00
1 parent 90c19b5a94
commit a22b4497a5
8 files changed
+322 -11

No files matched your search

@@ -649,6 +649,14 @@ pub async fn upload_artifact(
// add-artifact endpoint, not upload.
let mut artifact = uploaded_artifact(kind, plc_format, &filename, &upload.path, upload.size)
.ok_or(StatusCode::BAD_REQUEST)?;
// What a scheduled scan compares to tell this upload from the files its
// last scan read (#465): without it, no upload was ever known unchanged.
let path = upload.path.clone();
let (sha, _) = tokio::task::spawn_blocking(move || crate::ingest::blob::hash_file(&path))
.await
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
artifact.content_hash = Some(sha);
if kind != ArtifactKind::FirmwareImage {
match archive_check(upload.path.clone()).await? {
// 7z and rar are never unpacked: say so now, not after a scan.