Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/4511

Vanessaa5b386644b34
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index be40eb2bc0..79710c3208 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1684,7 +1684,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (localFiles.length > 0) {
let fileText = "";
localFiles.forEach((item) => {
- fileText += `[${path.basename(item)}](file://${item})\n`;
+ fileText += `[${path.basename(item).replace(/\]/g, "\\]").replace(/\[/g, "\\[")}](file://${item.replace(/\\/g, "\\\\").replace(/\)/g, "\\)").replace(/\(/g, "\\(")})\n`;
});
insertHTML(protyle.lute.SpinBlockDOM(fileText), protyle);
} else {