api/processing: append audio extension to filename before response
This commit is contained in:
parent
c52aa76426
commit
438fce3c58
2 changed files with 6 additions and 7 deletions
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue