Fix incorrect message counter

This commit is contained in:
Cohee 2024-10-31 20:07:23 +02:00
parent 6e36b77f1a
commit e0e60a1d00

View File

@ -615,7 +615,7 @@ router.post('/search', jsonParser, function (request, response) {
const data = fs.readFileSync(chatFile.path, 'utf8');
const messages = data.split('\n')
.map(line => { try { return JSON.parse(line); } catch (_) { return null; } })
.filter(x => x);
.filter(x => x && typeof x.mes === 'string');
if (messages.length === 0) {
continue;