aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/controllers/static.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index 8bebe6fa7..139ba67cc 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -77,20 +77,20 @@ async function getPreview (req: express.Request, res: express.Response, next: ex
77} 77}
78 78
79async function downloadTorrent (req: express.Request, res: express.Response, next: express.NextFunction) { 79async function downloadTorrent (req: express.Request, res: express.Response, next: express.NextFunction) {
80 const { video, videoFile } = getVideoAndFileOr404(req, res) 80 const { video, videoFile } = getVideoAndFile(req, res)
81 if (!videoFile) return res.status(404).end() 81 if (!videoFile) return res.status(404).end()
82 82
83 return res.download(video.getTorrentFilePath(videoFile), `${video.name}-${videoFile.resolution}p.torrent`) 83 return res.download(video.getTorrentFilePath(videoFile), `${video.name}-${videoFile.resolution}p.torrent`)
84} 84}
85 85
86async function downloadVideoFile (req: express.Request, res: express.Response, next: express.NextFunction) { 86async function downloadVideoFile (req: express.Request, res: express.Response, next: express.NextFunction) {
87 const { video, videoFile } = getVideoAndFileOr404(req, res) 87 const { video, videoFile } = getVideoAndFile(req, res)
88 if (!videoFile) return res.status(404).end() 88 if (!videoFile) return res.status(404).end()
89 89
90 return res.download(video.getVideoFilePath(videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`) 90 return res.download(video.getVideoFilePath(videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`)
91} 91}
92 92
93function getVideoAndFileOr404 (req: express.Request, res: express.Response) { 93function getVideoAndFile (req: express.Request, res: express.Response) {
94 const resolution = parseInt(req.params.resolution, 10) 94 const resolution = parseInt(req.params.resolution, 10)
95 const video: VideoModel = res.locals.video 95 const video: VideoModel = res.locals.video
96 96