Compare commits

...

3 Commits

Author SHA1 Message Date
dea9f4c063 remove unnecessary log 2024-09-13 22:37:38 +01:00
0b6730c06f fix page export failure when title contains non-ASCII characters (#309) 2024-09-13 17:40:24 +01:00
be0d97661a update README 2024-09-04 18:56:14 +01:00
4 changed files with 12 additions and 7 deletions

View File

@ -17,6 +17,7 @@ To get started with Docmost, please refer to our [documentation](https://docmost
## Features
- Real-time collaboration
- Diagrams (Draw.io, Excalidraw and Mermaid)
- Spaces
- Permissions management
- Groups
@ -32,4 +33,4 @@ To get started with Docmost, please refer to our [documentation](https://docmost
</p>
### Contributing
See the [development doc](https://docmost.com/docs/self-hosting/development)
See the [development documentation](https://docmost.com/docs/self-hosting/development)

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);