From 7942a025e817bcb9a09dbece90b0b5de9aba9ac4 Mon Sep 17 00:00:00 2001 From: Kerboul Date: Mon, 31 Mar 2025 09:39:30 +0200 Subject: [PATCH] =?UTF-8?q?Refactor=20la=20gestion=20des=20fichiers=20vid?= =?UTF-8?q?=C3=A9o=20pour=20utiliser=20un=20chemin=20de=20vid=C3=A9o=20par?= =?UTF-8?q?=20d=C3=A9faut=20en=20cas=20d'absence=20de=20fichier,=20am?= =?UTF-8?q?=C3=A9liorant=20ainsi=20la=20robustesse=20du=20service.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/videoRoutes.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/routes/videoRoutes.js b/routes/videoRoutes.js index 604c8d5..f9b9381 100644 --- a/routes/videoRoutes.js +++ b/routes/videoRoutes.js @@ -134,14 +134,13 @@ router.get('/videos/file/:video_id', (req, res) => { return res.status(400).json({ error: 'Video not yet produced' }); } - const videoPath = video.video_file; + let videoPath = video.video_file; // Check if the video file exists fs.access(videoPath, fs.constants.F_OK, (err) => { if (err) { console.error('Video file not found:', err); videoPath = dbTester.getCatVideo(); - // return res.status(404).json({ error: 'Video file not found' }); } const stat = fs.statSync(videoPath);