[mirotalksfu] - Add missing fileName validation

هذا الالتزام موجود في:
Miroslav Pejic
2024-08-05 07:49:43 +02:00
الأصل dc4d06178f
التزام 7f738d9a0c
6 ملفات معدلة مع 30 إضافات و9 حذوفات

عرض الملف

@@ -48,6 +48,10 @@ app.post('/recSync', (req, res) => {
return res.status(400).send('Filename not provided');
}
if (!isValidVideo(fileName)) {
return res.status(400).send('Invalid file name');
}
ensureRecordingDirectoryExists();
const filePath = path.join(recordingDirectory, fileName);
@@ -75,3 +79,8 @@ app.post('/recSync', (req, res) => {
app.listen(port, () => {
log.debug(`Server is running on http://localhost:${port}`);
});
function isValidVideo(input) {
if (input.endsWith('.mp4') || input.endsWith('.webm') || input.endsWith('.ogg')) return true;
return false;
}