From 411ea7a9046241cbc04b4b87272ab2a7e31a182f Mon Sep 17 00:00:00 2001 From: Kerboul Date: Mon, 31 Mar 2025 09:41:43 +0200 Subject: [PATCH] =?UTF-8?q?Ajouter=20une=20v=C3=A9rification=20pour=20le?= =?UTF-8?q?=20chemin=20du=20fichier=20vid=C3=A9o,=20en=20utilisant=20une?= =?UTF-8?q?=20vid=C3=A9o=20de=20secours=20si=20le=20chemin=20est=20nul=20o?= =?UTF-8?q?u=20ind=C3=A9fini,=20am=C3=A9liorant=20ainsi=20la=20robustesse?= =?UTF-8?q?=20du=20service.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/videoRoutes.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/videoRoutes.js b/routes/videoRoutes.js index f9b9381..d7ac2aa 100644 --- a/routes/videoRoutes.js +++ b/routes/videoRoutes.js @@ -136,6 +136,11 @@ router.get('/videos/file/:video_id', (req, res) => { let videoPath = video.video_file; + if (!videoPath) { + console.error('Video file path is null or undefined'); + videoPath = dbTester.getCatVideo(); + } + // Check if the video file exists fs.access(videoPath, fs.constants.F_OK, (err) => { if (err) {