[mirotalksfu] - fix cloud

هذا الالتزام موجود في:
Miroslav Pejic
2024-08-05 21:38:52 +02:00
الأصل 8414e4e108
التزام b018f4ad29
2 ملفات معدلة مع 15 إضافات و7 حذوفات

عرض الملف

@@ -50,7 +50,7 @@ app.post('/recSync', (req, res) => {
return res.status(400).send('Filename not provided');
}
if (!fileName.startsWith('Rec_') && !fileName.endsWith('.webm')) {
if (!isValidRecFileNameFormat(fileName)) {
log.warn('[RecSync] - Invalid file name', fileName);
return res.status(400).send('Invalid file name');
}
@@ -86,3 +86,13 @@ app.post('/recSync', (req, res) => {
app.listen(port, () => {
log.debug(`Server is running on http://localhost:${port}`);
});
// Utils
function isValidRecFileNameFormat(input) {
if (typeof input !== 'string') {
return false;
}
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);
}