mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Make sure rejected promise is not cached in malware list / new packages cache
This commit is contained in:
parent
2930894624
commit
9fae225277
2 changed files with 5 additions and 1 deletions
|
|
@ -65,11 +65,14 @@ export function openMalwareDatabase() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getPackageStatus,
|
getPackageStatus,
|
||||||
isMalware: (name, version) => {
|
isMalware: (/** @type {string} */ name, /** @type {string} */ version) => {
|
||||||
const status = getPackageStatus(name, version);
|
const status = getPackageStatus(name, version);
|
||||||
return isMalwareStatus(status);
|
return isMalwareStatus(status);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}).catch((error) => {
|
||||||
|
cachedMalwareDatabasePromise = null;
|
||||||
|
throw error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return cachedMalwareDatabasePromise;
|
return cachedMalwareDatabasePromise;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ export function openNewPackagesDatabase() {
|
||||||
.then((newPackagesList) => buildNewPackagesDatabase(newPackagesList))
|
.then((newPackagesList) => buildNewPackagesDatabase(newPackagesList))
|
||||||
.catch((/** @type {any} */ error) => {
|
.catch((/** @type {any} */ error) => {
|
||||||
warnOnceAboutUnavailableDatabase(error);
|
warnOnceAboutUnavailableDatabase(error);
|
||||||
|
cachedNewPackagesDatabasePromise = null;
|
||||||
return { isNewlyReleasedPackage: () => false };
|
return { isNewlyReleasedPackage: () => false };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue