[mirotalksfu] - fix

هذا الالتزام موجود في:
Miroslav Pejic
2024-08-05 15:34:20 +02:00
الأصل 2e18650432
التزام 760d01ca71
2 ملفات معدلة مع 2 إضافات و16 حذوفات

عرض الملف

@@ -661,7 +661,7 @@ function startServer() {
// Rec_test_2024_08_03_16_17_01.webm // Rec_test_2024_08_03_16_17_01.webm
if (!isValidRecFileNameFormat(fileName)) { if (!fileName.startsWith('Rec_') && !fileName.endsWith('.webm')) {
log.warn('[RecSync] - Invalid file name', fileName); log.warn('[RecSync] - Invalid file name', fileName);
return res.status(400).send('Invalid file name'); return res.status(400).send('Invalid file name');
} }
@@ -2960,12 +2960,4 @@ function startServer() {
} }
} }
} }
// Utils...
function isValidRecFileNameFormat(input) {
const pattern =
/^Rec_(?:[A-Za-z0-9-_]+|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})_\d{4}_\d{2}_\d{2}_\d{2}_\d{2}_\d{2}\.(webm)$/;
return pattern.test(input);
}
} }

عرض الملف

@@ -50,7 +50,7 @@ app.post('/recSync', (req, res) => {
return res.status(400).send('Filename not provided'); return res.status(400).send('Filename not provided');
} }
if (!isValidRecFileNameFormat(fileName)) { if (!fileName.startsWith('Rec_') && !fileName.endsWith('.webm')) {
log.warn('[RecSync] - Invalid file name', fileName); log.warn('[RecSync] - Invalid file name', fileName);
return res.status(400).send('Invalid file name'); return res.status(400).send('Invalid file name');
} }
@@ -86,9 +86,3 @@ app.post('/recSync', (req, res) => {
app.listen(port, () => { app.listen(port, () => {
log.debug(`Server is running on http://localhost:${port}`); log.debug(`Server is running on http://localhost:${port}`);
}); });
function isValidRecFileNameFormat(input) {
const pattern =
/^Rec_(?:[A-Za-z0-9-_]+|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})_\d{4}_\d{2}_\d{2}_\d{2}_\d{2}_\d{2}\.(webm)$/;
return pattern.test(input);
}