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:
@@ -136,6 +136,11 @@ router.get('/videos/file/:video_id', (req, res) => {
|
|||||||
|
|
||||||
let videoPath = video.video_file;
|
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
|
// Check if the video file exists
|
||||||
fs.access(videoPath, fs.constants.F_OK, (err) => {
|
fs.access(videoPath, fs.constants.F_OK, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user