From b4f87ca45c81d2811dcc1cfdbc4d65e862035bc9 Mon Sep 17 00:00:00 2001 From: Kaylee Sachs Date: Mon, 29 Sep 2025 21:51:55 +0200 Subject: [PATCH] Fixed: Check file extension when loading all --- db.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db.js b/db.js index 4e9e696..32891f4 100644 --- a/db.js +++ b/db.js @@ -49,6 +49,7 @@ function dbGet(table, id) { let data = tableCache(table)[id]; if (data === undefined) { if (fs.existsSync(file)) { + console.log(`Loading ${table} with ID ${id} from disk: '${file}'`) data = dbDeserialize(fs.readFileSync(file)); } else { data = null; @@ -68,6 +69,9 @@ function dbGetAll(table) { const files = fs.readdirSync(dbDir(table)); const all = []; for (const file of files) { + if (!file.endsWith('.json')) { + continue; + } const id = file.split('.')[0]; const data = dbGet(table, id); if (!data) {