Skip to content

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

:art: 去掉工作空间路径尾部空格 Fix https://github.com/siyuan-note/siyuan/issues/6353

Liang Dingaecce8ac40fd
diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go
index 3735e01bce..00bc305a83 100644
--- a/kernel/api/workspace.go
+++ b/kernel/api/workspace.go
@@ -38,6 +38,11 @@ func listWorkspaceDirs(c *gin.Context) {
userHomeConfDir := filepath.Join(util.HomeDir, ".config", "siyuan")
workspaceConf := filepath.Join(userHomeConfDir, "workspace.json")
data, err := os.ReadFile(workspaceConf)
+ if nil != err {
+ logging.LogErrorf("read workspace conf [%s] failed: %s", workspaceConf, err)
+ return
+ }
+
var workspacePaths []string
if err = gulu.JSON.UnmarshalJSON(data, &workspacePaths); nil != err {
logging.LogErrorf("unmarshal workspace conf [%s] failed: %s", workspaceConf, err)
diff --git a/kernel/util/working.go b/kernel/util/working.go
index f5dba17054..69829e60a3 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -219,6 +219,7 @@ func initWorkspaceDir(workspaceArg string) {
tmp := workspacePaths[:0]
for _, d := range workspacePaths {
+ d = strings.TrimRight(d, " \t\n") // 去掉工作空间路径尾部空格 https://github.com/siyuan-note/siyuan/issues/6353
if gulu.File.IsDir(d) {
tmp = append(tmp, d)
}