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

This commit is contained in:
Liang Ding 2022-10-25 21:30:58 +08:00
parent 92e4df2483
commit aecce8ac40
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 6 additions and 0 deletions

View file

@ -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)

View file

@ -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)
}