X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fdownload.ts;h=a270180c0228e6b3250779e1705160e1b296be4d;hb=4404a7c467a2c6863728127eeff5ca4b59619940;hp=8da710669c6400ee791b2bf1fb5b86d5343ae3ea;hpb=41fb13c330de629df2d23379209e79c7af0f2e9a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/download.ts b/server/controllers/download.ts index 8da710669..a270180c0 100644 --- a/server/controllers/download.ts +++ b/server/controllers/download.ts @@ -85,8 +85,10 @@ async function downloadVideoFile (req: express.Request, res: express.Response) { return res.redirect(videoFile.getObjectStorageUrl()) } - await VideoPathManager.Instance.makeAvailableVideoFile(video, videoFile, path => { - const filename = `${video.name}-${videoFile.resolution}p${videoFile.extname}` + await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), path => { + // Express uses basename on filename parameter + const videoName = video.name.replace(/[/\\]/g, '_') + const filename = `${videoName}-${videoFile.resolution}p${videoFile.extname}` return res.download(path, filename) }) @@ -119,7 +121,7 @@ async function downloadHLSVideoFile (req: express.Request, res: express.Response return res.redirect(videoFile.getObjectStorageUrl()) } - await VideoPathManager.Instance.makeAvailableVideoFile(streamingPlaylist, videoFile, path => { + await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(streamingPlaylist), path => { const filename = `${video.name}-${videoFile.resolution}p-${streamingPlaylist.getStringType()}${videoFile.extname}` return res.download(path, filename)