fix(plugin-import): sheet name cannot contain : \ / ? * [ ]

This commit is contained in:
chenos 2023-03-28 10:33:36 +08:00
parent a6fc04503d
commit 708675deb9

View File

@ -14,7 +14,7 @@ export async function downloadXlsxTemplate(ctx: Context, next: Next) {
ctx.body = xlsx.build([ ctx.body = xlsx.build([
{ {
name: title, name: 'Sheet 1',
data, data,
options: {}, options: {},
}, },
@ -23,7 +23,7 @@ export async function downloadXlsxTemplate(ctx: Context, next: Next) {
ctx.set({ ctx.set({
'Content-Type': 'application/octet-stream', 'Content-Type': 'application/octet-stream',
// to avoid "invalid character" error in header (RFC) // to avoid "invalid character" error in header (RFC)
'Content-Disposition': `attachment; filename=${encodeURI(title)}.xlsx`, 'Content-Disposition': `attachment; filename=${encodeURIComponent(title)}.xlsx`,
}); });
await next(); await next();