From dae28aacb0b74cfab286186c5ad6865dd2f49df0 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 5 Jan 2023 19:46:45 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9A=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/4642?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/workspace.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/api/workspace.go b/kernel/api/workspace.go index d29a7c64a..b5a4ad1e4 100644 --- a/kernel/api/workspace.go +++ b/kernel/api/workspace.go @@ -45,17 +45,18 @@ func createWorkspaceDir(c *gin.Context) { absPath := arg["path"].(string) absPath = gulu.Str.RemoveInvisible(absPath) absPath = strings.TrimSpace(absPath) - if gulu.File.IsExist(absPath) { - ret.Code = -1 - ret.Msg = model.Conf.Language(78) - return - } if isInvalidWorkspacePath(absPath) { ret.Code = -1 ret.Msg = "This workspace name is not allowed, please use another name" return } + if gulu.File.IsExist(absPath) { + ret.Code = -1 + ret.Msg = model.Conf.Language(78) + return + } + if err := os.MkdirAll(absPath, 0755); nil != err { ret.Code = -1 ret.Msg = fmt.Sprintf("create workspace dir [%s] failed: %s", absPath, err)