Skip to content

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

:art: 超链接锚文本中 `\]` 符号渲染时未正确转义 https://github.com/siyuan-note/siyuan/issues/4511

Liang Ding93dafd1c1244
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 5a341d9c52..ac87431c87 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -718,7 +718,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
let fileText = "";
files.forEach((item) => {
// 拖入文件名包含 `)` 或 `]` 的文件以 `file://` 插入后链接解析错误 https://github.com/siyuan-note/siyuan/issues/5786
- fileText += `[${path.basename(item.replace(/\]/g, "\\]").replace(/\[/g, "\\["))}](file://${item.replace(/\)/g, "\\)").replace(/\(/g, "\\(")})\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 {