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

@ -2,6 +2,14 @@
import path from "path";
import fs from "fs-extra";
export function serializeFilename(text: string): string {
return text.replace(/\//g, "%2F").replace(/\\/g, "%5C");
}
export function deserializeFilename(text: string): string {
return text.replace(/%2F/g, "/").replace(/%5C/g, "\\");
}
export function requireDirectory<T>(dirName: string): [T, string][] {
return fs
.readdirSync(dirName)