From 157e7c78f9428564278916833da919d95958dccc Mon Sep 17 00:00:00 2001 From: David Jakowenko Date: Sat, 11 Sep 2021 03:51:26 -0400 Subject: [PATCH] fix: don't reprocess if no detectors configured --- api/src/controllers/match.controller.js | 3 +++ frontend/src/components/Asset.vue | 1 + 2 files changed, 4 insertions(+) diff --git a/api/src/controllers/match.controller.js b/api/src/controllers/match.controller.js index 596b7d93..7d5d163b 100644 --- a/api/src/controllers/match.controller.js +++ b/api/src/controllers/match.controller.js @@ -8,6 +8,7 @@ const { jwt } = require('../util/auth.util'); const process = require('../util/process.util'); const { AUTH, STORAGE } = require('../constants'); const { BAD_REQUEST } = require('../constants/http-status'); +const DETECTORS = require('../constants/config').detectors(); let matchProps = []; @@ -95,6 +96,8 @@ module.exports.delete = async (req, res) => { module.exports.reprocess = async (req, res) => { const { matchId } = req.params; + if (!DETECTORS.length) return res.status(BAD_REQUEST).error('no detectors configured'); + const db = database.connect(); let [match] = db.prepare('SELECT * FROM match WHERE id = ?').bind(matchId).all(); diff --git a/frontend/src/components/Asset.vue b/frontend/src/components/Asset.vue index 5c505cbd..fab6fb4b 100644 --- a/frontend/src/components/Asset.vue +++ b/frontend/src/components/Asset.vue @@ -227,6 +227,7 @@ export default { this.emitter.emit('reprocess', data); this.reprocessing = false; } catch (error) { + this.reprocessing = false; this.emitter.emit('error', error); } },