mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Fix extension detection
This commit is contained in:
parent
017795cf45
commit
451dc9c024
2 changed files with 4 additions and 1 deletions
|
@ -33,6 +33,7 @@ import {
|
|||
videosDownloadValidator,
|
||||
videosGenerateDownloadValidator
|
||||
} from '../middlewares/index.js'
|
||||
import { parse } from 'node:url'
|
||||
|
||||
const lTags = loggerTagsFactory('download')
|
||||
|
||||
|
@ -252,7 +253,8 @@ async function downloadGeneratedVideoFile (req: express.Request, res: express.Re
|
|||
: maxResolutionFile.extname
|
||||
|
||||
// If there is the extension, we want to simulate a "raw file" and so not send the content disposition header
|
||||
if (!req.path.endsWith('.mp4') && !req.path.endsWith('.m4a')) {
|
||||
const urlPath = parse(req.originalUrl).pathname
|
||||
if (!urlPath.endsWith('.mp4') && !urlPath.endsWith('.m4a')) {
|
||||
const downloadFilename = buildDownloadFilename({ video, extname })
|
||||
res.setHeader('Content-disposition', `attachment; filename="${encodeURI(downloadFilename)}`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue