Fixed issue where missing video file would cause exception to be thrown when watching/previewing

This commit is contained in:
Tzahi12345
2023-11-30 00:30:07 -05:00
parent 2396c86486
commit 67c38039b0

View File

@@ -1650,6 +1650,7 @@ app.get('/api/stream', optionalJwt, async (req, res) => {
}
if (!fs.existsSync(file_path)) {
logger.error(`File ${file_path} could not be found! UID: ${uid}, ID: ${file_obj && file_obj.id}`);
return;
}
const stat = fs.statSync(file_path);
const fileSize = stat.size;