Merge branch 'main' into feature/pypi

This commit is contained in:
Reinier Criel 2025-11-04 06:54:00 -08:00
commit d789491561
26 changed files with 186 additions and 118 deletions

View file

@ -91,10 +91,19 @@ async function getMalwareDatabase() {
}
const { malwareDatabase, version } = await fetchMalwareDatabase();
// @ts-expect-error version can be undefined
writeDatabaseToLocalCache(malwareDatabase, version);
return malwareDatabase;
if (version) {
// Only cache the malware database when we have a version.
writeDatabaseToLocalCache(malwareDatabase, version);
return malwareDatabase;
} else {
// We received a valid malware database, but the response
// did not contain an etag header with the version
ui.writeWarning(
"The malware database was downloaded, but could not be cached due to a missing version."
);
return malwareDatabase;
}
} catch (/** @type any */ error) {
if (cachedDatabase) {
ui.writeWarning(