fix export fileName
This commit is contained in:
parent
a25cf84671
commit
ede5633415
2 changed files with 4 additions and 3 deletions
|
|
@ -24,9 +24,10 @@ import { FastifyReply } from 'fastify';
|
||||||
import { sanitize } from 'sanitize-filename-ts';
|
import { sanitize } from 'sanitize-filename-ts';
|
||||||
import { getExportExtension } from './utils';
|
import { getExportExtension } from './utils';
|
||||||
import { getMimeType } from '../../common/helpers';
|
import { getMimeType } from '../../common/helpers';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class ImportController {
|
export class ExportController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly exportService: ExportService,
|
private readonly exportService: ExportService,
|
||||||
private readonly pageRepo: PageRepo,
|
private readonly pageRepo: PageRepo,
|
||||||
|
|
@ -63,7 +64,7 @@ export class ImportController {
|
||||||
dto.format,
|
dto.format,
|
||||||
);
|
);
|
||||||
|
|
||||||
const newName = fileName + '.zip';
|
const newName = path.parse(fileName).name + '.zip';
|
||||||
|
|
||||||
res.headers({
|
res.headers({
|
||||||
'Content-Type': 'application/zip',
|
'Content-Type': 'application/zip',
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ export class ExportService {
|
||||||
compression: 'DEFLATE',
|
compression: 'DEFLATE',
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileName = `${space.name}-space-export${getExportExtension(format)}.zip`;
|
const fileName = `${space.name}-space-export.zip`;
|
||||||
return {
|
return {
|
||||||
fileBuffer: zipFile,
|
fileBuffer: zipFile,
|
||||||
fileName,
|
fileName,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue