fix: Document title with slashes produces folders in exported zip file

closes #2036
This commit is contained in:
Tom Moor
2021-04-17 19:30:31 -07:00
parent 03d90b3f15
commit e9f083feb8
6 changed files with 68 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import parseTitle from "../../shared/utils/parseTitle";
import { FileImportError, InvalidRequestError } from "../errors";
import { User } from "../models";
import dataURItoBuffer from "../utils/dataURItoBuffer";
import { deserializeFilename } from "../utils/fs";
import parseImages from "../utils/parseImages";
import attachmentCreator from "./attachmentCreator";
@ -152,7 +153,7 @@ export default async function documentImporter({
if (!fileInfo) {
throw new InvalidRequestError(`File type ${file.type} not supported`);
}
let title = file.name.replace(/\.[^/.]+$/, "");
let title = deserializeFilename(file.name.replace(/\.[^/.]+$/, ""));
let text = await fileInfo.getMarkdown(file);
// If the first line of the imported text looks like a markdown heading