An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: Optimize isLocalPath function to improve performance (#13990)
Jeffrey Chen1ec54282c7d8
diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.tsindex 95eabaaa87..bd7b7b5e04 100644--- a/app/src/util/pathName.ts+++ b/app/src/util/pathName.ts@@ -87,22 +87,14 @@ export const getAssetName = (assetPath: string) => {};export const isLocalPath = (link: string) => {- if (!link) {+ link = link?.trim();+ if (!link || link.length === 0) {return false;}- link = link.trim();- if (1 > link.length) {- return false;- }-- link = link.toLowerCase();- if (link.startsWith("assets/") || link.startsWith("file://") || link.startsWith("\\\\") /* Windows 网络共享路径 */) {- return true;- }-- const colonIdx = link.indexOf(":");- return 1 === colonIdx; // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议+ // Windows 网络共享路径双斜杠+ // 冒号前面只有一个字母认为是 Windows 盘符而不是网络协议+ return /^assets\/|file:\/\/|\\\\|[A-Z]:$/i.test(link);};export const pathPosix = () => {