Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: https://github.com/siyuan-note/siyuan/issues/5614

Vanessab45f5303fe1f
diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.ts
index d74d844bfe..928fd3b025 100644
--- a/app/src/editor/rename.ts
+++ b/app/src/editor/rename.ts
@@ -22,6 +22,10 @@ export const replaceFileName = (name: string) => {
return name.replace(/\r\n|\r|\n|\u2028|\u2029|\t|\//g, "");
};
+export const replaceLocalPath = (name: string) => {
+ return name.replace(/\\\\|\/|:|\*|\?|\\|'|<|>|\|/g, "");
+};
+
export const rename = (options: {
path: string
notebookId: string
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index c52b1e85d3..e9b8a05131 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -13,6 +13,7 @@ import {fetchPost} from "../../util/fetch";
import {Dialog} from "../../dialog";
import {lockFile} from "../../dialog/processSystem";
import {pathPosix} from "../../util/pathName";
+import {replaceLocalPath} from "../../editor/rename";
export const saveExport = (option: { type: string, id: string }) => {
/// #if !BROWSER
@@ -176,7 +177,7 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
} else if (option.type === "word") {
url = "/api/export/exportDocx";
}
- const savePath = result.filePaths[0].endsWith(response.data.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], response.data.rootTitle);
+ const savePath = result.filePaths[0].endsWith(response.data.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], replaceLocalPath(response.data.rootTitle));
fetchPost(url, {
id: option.id,
pdf: option.type === "pdf",