Fix invalid download filename

pull/5042/head
Chocobozzz 2022-06-03 14:28:43 +02:00
parent 5a2f775a21
commit 62f53731cf
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 3 additions and 1 deletions

View File

@ -86,7 +86,9 @@ async function downloadVideoFile (req: express.Request, res: express.Response) {
} }
await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), path => { await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), path => {
const filename = `${video.name}-${videoFile.resolution}p${videoFile.extname}` // 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) return res.download(path, filename)
}) })