Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Prevent an error when the video is deleted

Chocobozzza2dfe799a3a0
diff --git a/server/core/lib/video-captions.ts b/server/core/lib/video-captions.ts
index 1e3edbbd05..9e317b9d30 100644
--- a/server/core/lib/video-captions.ts
+++ b/server/core/lib/video-captions.ts
@@ -200,7 +200,13 @@ export async function generateSubtitle (options: {
format: 'vtt'
})
- await onTranscriptionEnded({ video, language: transcriptFile.language, vttPath: transcriptFile.path })
+ const refreshedVideo = await VideoModel.loadFull(video.uuid)
+ if (!refreshedVideo) {
+ logger.info(`Do not process transcription for video ${video.uuid}: it does not exist anymore.`, lTags(video.uuid))
+ return
+ }
+
+ await onTranscriptionEnded({ video: refreshedVideo, language: transcriptFile.language, vttPath: transcriptFile.path })
})
} finally {
if (outputPath) await remove(outputPath)