From 6b32a372bcdc44cbf9cc7b9c69a1424265b697db Mon Sep 17 00:00:00 2001 From: kmlbgn Date: Thu, 4 Apr 2024 17:20:07 +0800 Subject: [PATCH] fix: paths to lowercase #2 --- .gitignore | 1 + src/HierarchicalNamedLayoutStrategy.ts | 2 +- src/images.ts | 4 ++-- src/pull.ts | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f7a6777..e89d36d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ tabs/ css/ static/ *.orig +*.bak diff --git a/src/HierarchicalNamedLayoutStrategy.ts b/src/HierarchicalNamedLayoutStrategy.ts index f3d4533..1fd37ac 100644 --- a/src/HierarchicalNamedLayoutStrategy.ts +++ b/src/HierarchicalNamedLayoutStrategy.ts @@ -16,7 +16,7 @@ export class HierarchicalNamedLayoutStrategy extends LayoutStrategy { const path = context + "/" + sanitize(levelLabel).replaceAll(" ", "-"); const newPath = dirRoot + "/" + path; - fs.mkdirSync(newPath, { recursive: true }); + fs.mkdirSync(newPath.toLowerCase(), { recursive: true }); this.addCategoryMetadata(newPath, order, levelLabel); return path; } diff --git a/src/images.ts b/src/images.ts index 2514390..15b1230 100644 --- a/src/images.ts +++ b/src/images.ts @@ -195,8 +195,8 @@ function writeImageIfNew(path: string, buffer: Buffer) { if (fs.pathExistsSync(path)) { verbose("Replacing image " + path); } else { - verbose("Adding image " + path); - fs.mkdirsSync(Path.dirname(path)); + verbose("Adding image " + path.toLowerCase()); + fs.mkdirsSync(Path.dirname(path.toLowerCase())); } fs.createWriteStream(path).write(buffer); // async but we're not waiting } diff --git a/src/pull.ts b/src/pull.ts index f0866d1..aa7d915 100644 --- a/src/pull.ts +++ b/src/pull.ts @@ -301,9 +301,9 @@ async function getTabsPagesRecursively( } function writePage(page: NotionPage, finalMarkdown: string) { - const mdPath = layoutStrategy.getPathForPage(page, ".mdx"); + const mdPath = layoutStrategy.getPathForPage(page, ".mdx").toLowerCase(); verbose(`writing ${mdPath}`); - fs.writeFileSync(mdPath.toLowerCase(), finalMarkdown, {}); + fs.writeFileSync(mdPath, finalMarkdown, {}); ++counts.output_normally; }