Filter out invalid character files

This commit is contained in:
Cohee 2024-04-13 16:21:41 +03:00
parent 59657766b5
commit 10aa268ea2

View File

@ -876,7 +876,7 @@ router.post('/all', jsonParser, async function (request, response) {
const files = fs.readdirSync(request.user.directories.characters);
const pngFiles = files.filter(file => file.endsWith('.png'));
const processingPromises = pngFiles.map(file => processCharacter(file, request.user.directories));
const data = await Promise.all(processingPromises);
const data = (await Promise.all(processingPromises)).filter(c => c.name);
return response.send(data);
} catch (err) {
console.error(err);