From 15231be474da7b845f1bdcaa4e4b59fce48f6e59 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 15 Jan 2025 11:30:45 +0800 Subject: [PATCH] :art: Improve workspace path checking https://github.com/siyuan-note/siyuan/issues/7569 --- kernel/api/workspace.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go index e90a1fff8de..970215f7872 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}