Skip to content

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

:art: Improve workspace path checking https://github.com/siyuan-note/siyuan/issues/7569

Daniel15231be474da
diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go
index e90a1fff8d..970215f787 100644
--- a/kernel/api/workspace.go
+++ b/kernel/api/workspace.go
@@ -289,7 +289,7 @@ func setWorkspaceDir(c *gin.Context) {
// 改进判断工作空间路径实现 https://github.com/siyuan-note/siyuan/issues/7569
installDirLower := strings.ToLower(filepath.Dir(util.WorkingDir))
pathLower := strings.ToLower(path)
- if strings.HasPrefix(pathLower, installDirLower) && util.IsSubPath(installDirLower, pathLower) {
+ if strings.HasPrefix(pathLower, installDirLower) && (util.IsSubPath(installDirLower, pathLower) || filepath.Clean(installDirLower) == filepath.Clean(pathLower)) {
ret.Code = -1
ret.Msg = model.Conf.Language(98)
ret.Data = map[string]interface{}{"closeTimeout": 5000}