Compare commits

..

2 Commits

3 changed files with 10 additions and 6 deletions

View File

@ -64,7 +64,7 @@ export async function exportPage(data: IExportPageParams): Promise<void> {
.split("filename=")[1]
.replace(/"/g, "");
saveAs(req.data, fileName);
saveAs(req.data, decodeURIComponent(fileName));
}
export async function importPage(file: File, spaceId: string) {
@ -81,14 +81,17 @@ export async function importPage(file: File, spaceId: string) {
return req.data;
}
export async function uploadFile(file: File, pageId: string, attachmentId?: string): Promise<IAttachment> {
export async function uploadFile(
file: File,
pageId: string,
attachmentId?: string,
): Promise<IAttachment> {
const formData = new FormData();
if(attachmentId){
if (attachmentId) {
formData.append("attachmentId", attachmentId);
}
formData.append("pageId", pageId);
formData.append("file", file);
const req = await api.post<IAttachment>("/files/upload", formData, {
headers: {

View File

@ -182,7 +182,7 @@ export class AttachmentController {
if (!inlineFileExtensions.includes(attachment.fileExt)) {
res.header(
'Content-Disposition',
`attachment; filename="${attachment.fileName}"`,
`attachment; filename="${encodeURIComponent(attachment.fileName)}"`,
);
}

View File

@ -61,7 +61,8 @@ export class ImportController {
res.headers({
'Content-Type': getMimeType(fileExt),
'Content-Disposition': 'attachment; filename="' + fileName + '"',
'Content-Disposition':
'attachment; filename="' + encodeURIComponent(fileName) + '"',
});
res.send(rawContent);