Gracefully handle removed technologies

main
Elbert Alias 4 years ago
parent 1cd2915f52
commit 781af50471

@ -275,7 +275,9 @@ const Driver = {
}) })
// Remove duplicates // Remove duplicates
cache.detections = cache.detections.concat(detections) cache.detections = cache.detections
.concat(detections)
.filter(({ technology }) => technology)
cache.detections.filter( cache.detections.filter(
({ technology: { name }, pattern: { regex } }, index) => ({ technology: { name }, pattern: { regex } }, index) =>
@ -309,7 +311,9 @@ const Driver = {
...cache, ...cache,
[hostname]: { [hostname]: {
...Driver.cache.hostnames[hostname], ...Driver.cache.hostnames[hostname],
detections: Driver.cache.hostnames[hostname].detections.map( detections: Driver.cache.hostnames[hostname].detections
.filter(({ technology }) => technology)
.map(
({ ({
technology: { name: technology }, technology: { name: technology },
pattern: { regex, confidence }, pattern: { regex, confidence },

@ -34,7 +34,9 @@ const Wappalyzer = {
let version = '' let version = ''
let confidence = 0 let confidence = 0
detections.forEach( detections
.filter(({ technology }) => technology)
.forEach(
({ technology: { name }, pattern, version: _version = '' }) => { ({ technology: { name }, pattern, version: _version = '' }) => {
if (name === technology.name) { if (name === technology.name) {
confidence = Math.min(100, confidence + pattern.confidence) confidence = Math.min(100, confidence + pattern.confidence)

Loading…
Cancel
Save