Ajouter une vérification pour le chemin du fichier vidéo, en utilisant une vidéo de secours si le chemin est nul ou indéfini, améliorant ainsi la robustesse du service.

This commit is contained in:
2025-03-31 09:41:43 +02:00
parent 7942a025e8
commit 411ea7a904

View File

@@ -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) {