feat(file): 新增启用下载(文件名为显示名称), 前端 > 2.14.264

This commit is contained in:
xream
2024-10-07 17:26:15 +08:00
parent 02031019f7
commit dc320eaa6c
2 changed files with 9 additions and 2 deletions

View File

@@ -141,7 +141,14 @@ async function getFile(req, res) {
)}`,
);
}
if (file.download) {
res.set(
'Content-Disposition',
`attachment; filename*=UTF-8''${encodeURIComponent(
file.displayName || file.name,
)}`,
);
}
res.set('Content-Type', 'text/plain; charset=utf-8').send(
output ?? '',
);