From 708675deb9c36a7db10035d1f1f7a06088353436 Mon Sep 17 00:00:00 2001 From: chenos Date: Tue, 28 Mar 2023 10:33:36 +0800 Subject: [PATCH] fix(plugin-import): sheet name cannot contain : \ / ? * [ ] --- .../plugins/import/src/server/actions/downloadXlsxTemplate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugins/import/src/server/actions/downloadXlsxTemplate.ts b/packages/plugins/import/src/server/actions/downloadXlsxTemplate.ts index a5141f051..6be9caf04 100644 --- a/packages/plugins/import/src/server/actions/downloadXlsxTemplate.ts +++ b/packages/plugins/import/src/server/actions/downloadXlsxTemplate.ts @@ -14,7 +14,7 @@ export async function downloadXlsxTemplate(ctx: Context, next: Next) { ctx.body = xlsx.build([ { - name: title, + name: 'Sheet 1', data, options: {}, }, @@ -23,7 +23,7 @@ export async function downloadXlsxTemplate(ctx: Context, next: Next) { ctx.set({ 'Content-Type': 'application/octet-stream', // to avoid "invalid character" error in header (RFC) - 'Content-Disposition': `attachment; filename=${encodeURI(title)}.xlsx`, + 'Content-Disposition': `attachment; filename=${encodeURIComponent(title)}.xlsx`, }); await next();