X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fdownload.ts;h=43d525f83a0de14ed9f24bffe348b704e31941fd;hb=06aad80165d09a8863ab8103149a8ff518b10641;hp=ffe40d57e3ce699f40978f67874c2d813ed1d8ba;hpb=0305db28c98fd6cf43a3c50ba92c76215e99d512;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/download.ts b/server/controllers/download.ts index ffe40d57e..43d525f83 100644 --- a/server/controllers/download.ts +++ b/server/controllers/download.ts @@ -1,5 +1,5 @@ -import * as cors from 'cors' -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { logger } from '@server/helpers/logger' import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' import { Hooks } from '@server/lib/plugins/hooks' @@ -85,7 +85,7 @@ async function downloadVideoFile (req: express.Request, res: express.Response) { return res.redirect(videoFile.getObjectStorageUrl()) } - await VideoPathManager.Instance.makeAvailableVideoFile(video, videoFile, path => { + await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), path => { const filename = `${video.name}-${videoFile.resolution}p${videoFile.extname}` return res.download(path, filename) @@ -119,7 +119,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)