From 3af3935fcac43cc2cfc03b654059e1d26a77f57c Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:14:22 +0800 Subject: [PATCH] fix: safe file name close #1129 --- apps/main/src/tipc/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/main/src/tipc/app.ts b/apps/main/src/tipc/app.ts index d932e86ff..0b09a1d7a 100644 --- a/apps/main/src/tipc/app.ts +++ b/apps/main/src/tipc/app.ts @@ -241,7 +241,7 @@ export const appRoute = { try { const { url, title, content, author, publishedAt, vaultPath } = input - const fileName = `${(title || publishedAt).trim().slice(0, 20)}.md` + const fileName = `${(title || publishedAt).trim().slice(0, 20).replaceAll("/", "-")}.md` const filePath = path.join(vaultPath, fileName) const exists = fs.existsSync(filePath) if (exists) {