diff --git a/api/src/processing/match-action.js b/api/src/processing/match-action.js index b8e39355..2e7b7f1b 100644 --- a/api/src/processing/match-action.js +++ b/api/src/processing/match-action.js @@ -196,6 +196,10 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab break; } + if (defaultParams.filename && (action === "picker" || action === "audio")) { + defaultParams.filename += `.${audioFormat}`; + } + if (alwaysProxy && responseType === "redirect") { responseType = "tunnel"; params.type = "proxy"; diff --git a/api/src/stream/types.js b/api/src/stream/types.js index 1076468d..ed949e5e 100644 --- a/api/src/stream/types.js +++ b/api/src/stream/types.js @@ -47,13 +47,8 @@ const proxy = async (streamInfo, res) => { ); try { - let filename = streamInfo.filename; - if (streamInfo.audioFormat) { - filename = `${streamInfo.filename}.${streamInfo.audioFormat}` - } - res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin'); - res.setHeader('Content-disposition', contentDisposition(filename)); + res.setHeader('Content-disposition', contentDisposition(streamInfo.filename)); const { body: stream, headers, statusCode } = await request(streamInfo.urls, { headers: { @@ -255,7 +250,7 @@ const convertAudio = (streamInfo, res) => { const [,,, muxOutput] = process.stdio; res.setHeader('Connection', 'keep-alive'); - res.setHeader('Content-Disposition', contentDisposition(`${streamInfo.filename}.${streamInfo.audioFormat}`)); + res.setHeader('Content-Disposition', contentDisposition(streamInfo.filename)); pipe(muxOutput, res, shutdown); res.on('finish', shutdown);