Skip to content

Commit

Permalink
[mirotalksfu] - fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Aug 5, 2024
1 parent 39864b7 commit 2e18650
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
11 changes: 6 additions & 5 deletions app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ function startServer() {
const roomId = parts[1];

if (!roomList.has(roomId)) {
log.warn('[RecSync] - ROomID not exists in filename', fileName);
log.warn('[RecSync] - RoomID not exists in filename', fileName);
return res.status(400).send('Invalid file name');
}

Expand All @@ -683,16 +683,16 @@ function startServer() {
req.pipe(writeStream);

writeStream.on('error', (err) => {
log.error('Error writing to file:', err.message);
log.error('[RecSync] - Error writing to file:', err.message);
res.status(500).send('Internal Server Error');
});

writeStream.on('finish', () => {
log.debug('File saved successfully:', fileName);
log.debug('[RecSync] - File saved successfully:', fileName);
res.status(200).send('File uploaded successfully');
});
} catch (err) {
log.error('Error processing upload', err.message);
log.error('[RecSync] - Error processing upload', err.message);
res.status(500).send('Internal Server Error');
}
}
Expand Down Expand Up @@ -2964,7 +2964,8 @@ 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)$/;
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);
}
}
15 changes: 8 additions & 7 deletions cloud/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ app.post('/recSync', (req, res) => {
}

if (!isValidRecFileNameFormat(fileName)) {
log.warn('Invalid file name', fileName);
log.warn('[RecSync] - Invalid file name', fileName);
return res.status(400).send('Invalid file name');
}

Expand All @@ -63,21 +63,21 @@ app.post('/recSync', (req, res) => {
req.pipe(writeStream);

writeStream.on('error', (err) => {
log.error('Error writing to file:', err.message);
log.error('[RecSync] - Error writing to file:', err.message);
res.status(500).send('Internal Server Error');
});

writeStream.on('finish', () => {
log.debug('File saved successfully:', fileName);
log.debug('[RecSync] - File saved successfully:', fileName);
res.status(200).send('File uploaded successfully');
});

req.on('error', (err) => {
log.error('Error processing request:', err.message);
log.error('[RecSync] - Error processing request:', err.message);
res.status(500).send('Internal Server Error');
});
} catch (err) {
log.error('Error processing upload', err.message);
log.error('[RecSync] - Error processing upload', err.message);
res.status(500).send('Internal Server Error');
}
});
Expand All @@ -88,6 +88,7 @@ app.listen(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)$/;
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);
}
}

0 comments on commit 2e18650

Please sign in to comment.