Skip to content

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

:art: Stop exposing the absolute workspace path to browsers https://github.com/siyuan-note/siyuan/issues/17410

Daniele06a31673c95
diff --git a/app/src/util/processTitle.ts b/app/src/util/processTitle.ts
index 4a5709e978..5706a34738 100644
--- a/app/src/util/processTitle.ts
+++ b/app/src/util/processTitle.ts
@@ -5,8 +5,10 @@ import {pathPosix} from "./pathName";
export const getWorkspaceName = () => {
const dir = window.siyuan.config.system.workspaceDir;
// 浏览器环境下内核不返回工作空间绝对路径,回退到应用名以避免标题/顶栏出现空段
+ // 注意:该函数可能在 languages 加载前(如 setBodyHighlight)被调用,故用可选链,
+ // 此时返回 undefined,由调用方(setBodyHighlight 的 if(!name) return)跳过处理
// https://github.com/siyuan-note/siyuan/issues/17410
- return dir ? pathPosix().basename(dir.replace(/\\/g, "/")) : window.siyuan.languages.siyuanNote;
+ return dir ? pathPosix().basename(dir.replace(/\\/g, "/")) : window.siyuan.languages?.siyuanNote;
};
export const setTitle = (title: string, showVersionTitle = false) => {