Skip to content

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

:bug: Fix local file open issue https://github.com/siyuan-note/siyuan/issues/14052

Daniel1dcdab24a7d6
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index ecacc1bfca..096da95987 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -151,6 +151,10 @@ export const isWin11 = async () => {
return false;
};
+export const isWindows = () => {
+ return navigator.platform.toUpperCase().indexOf("WIN") > -1;
+}
+
export const isInAndroid = () => {
return window.siyuan.config.system.container === "android" && window.JSAndroid;
};
diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.ts
index 95eabaaa87..5db602b74f 100644
--- a/app/src/util/pathName.ts
+++ b/app/src/util/pathName.ts
@@ -10,7 +10,7 @@ import {Constants} from "../constants";
import {ipcRenderer} from "electron";
/// #endif
import {showMessage} from "../dialog/message";
-import {isOnlyMeta, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
+import {isOnlyMeta, isWindows, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
import {matchHotKey} from "../protyle/util/hotKey";
import {Menu} from "../plugin/Menu";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
@@ -101,8 +101,11 @@ export const isLocalPath = (link: string) => {
return true;
}
- const colonIdx = link.indexOf(":");
- return 1 === colonIdx; // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议
+ if (isWindows()) {
+ const colonIdx = link.indexOf(":");
+ return 1 === colonIdx; // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议
+ }
+ return link.startsWith("/")
};
export const pathPosix = () => {