mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 Renaming a directory using the kernel API /api/file/renameFile indicates that the file is in use https://github.com/siyuan-note/siyuan/issues/8635
This commit is contained in:
parent
255fa9d601
commit
938f450097
1 changed files with 6 additions and 0 deletions
|
|
@ -196,6 +196,7 @@ func renameFile(c *gin.Context) {
|
|||
_, err := os.Stat(filePath)
|
||||
if os.IsNotExist(err) {
|
||||
ret.Code = 404
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
if nil != err {
|
||||
|
|
@ -207,6 +208,11 @@ func renameFile(c *gin.Context) {
|
|||
|
||||
newPath := arg["newPath"].(string)
|
||||
newPath = filepath.Join(util.WorkspaceDir, newPath)
|
||||
if gulu.File.IsExist(newPath) {
|
||||
ret.Code = 409
|
||||
ret.Msg = "the [newPath] file or directory already exists"
|
||||
return
|
||||
}
|
||||
|
||||
if err = filelock.Rename(filePath, newPath); nil != err {
|
||||
logging.LogErrorf("rename file [%s] to [%s] failed: %s", filePath, newPath, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue