fix download file ext

This commit is contained in:
Jay 2019-08-13 12:49:10 +00:00
parent 1fda2ff1f6
commit d9ed3ffe15

View File

@ -51,7 +51,7 @@ r.get('/download', async c => {
const fileInfo = store.get(file)
let fn = file
if (fileInfo !== null && 'title' in fileInfo) fn = fileInfo.title
if (fileInfo !== null && 'title' in fileInfo) fn = `${fileInfo.title}.mp3`
const rs = fs.createReadStream(fp)
c.set('Content-disposition', `attachment; filename="${encodeURIComponent(fn)}"; filename*="utf8''${encodeURIComponent(fn)}";`)