mirror of
https://github.com/docmost/docmost.git
synced 2025-11-16 08:01:11 +10:00
fix export fileName
This commit is contained in:
@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user