diff --git a/src/router/websocket.ts b/src/router/websocket.ts index 2ec34fa..d2a03c9 100644 --- a/src/router/websocket.ts +++ b/src/router/websocket.ts @@ -26,12 +26,14 @@ const cleanup = async (ws: any, videoId: string) => { const handleUpload = async (ws: any, videoId: string, isChannel: boolean = false) => { // the pattern of files that have finished downloading is [videoid].mp4, but some extensions are also possible due to // current youtube changes, so we need to make sure the other extensions are also covered - const filePath = fs.readdirSync('./videos/').find(f => f.includes(`${videoId}.`)) + let filePath = fs.readdirSync('./videos/').find(f => f.includes(`${videoId}.`)) if (!filePath) { ws.send(`DATA - Video file for ${videoId} not found. Skipping.`); return false; } + filePath = './videos/' + filePath + try { ws.send('DATA - Uploading file...'); const videoUrl = await uploadVideo(filePath);