mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 01:08:49 +01:00
🎨 Add kernel API /api/file/renameFile https://github.com/siyuan-note/siyuan/issues/8328
This commit is contained in:
parent
0ef094bc44
commit
8c843f8775
1 changed files with 5 additions and 3 deletions
|
|
@ -185,12 +185,13 @@ func renameFile(c *gin.Context) {
|
|||
filePath = filepath.Join(util.WorkspaceDir, filePath)
|
||||
_, err := os.Stat(filePath)
|
||||
if os.IsNotExist(err) {
|
||||
c.Status(404)
|
||||
ret.Code = 404
|
||||
return
|
||||
}
|
||||
if nil != err {
|
||||
logging.LogErrorf("stat [%s] failed: %s", filePath, err)
|
||||
c.Status(500)
|
||||
ret.Code = 500
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +200,8 @@ func renameFile(c *gin.Context) {
|
|||
|
||||
if err = filelock.Rename(filePath, newPath); nil != err {
|
||||
logging.LogErrorf("rename file [%s] to [%s] failed: %s", filePath, newPath, err)
|
||||
c.Status(500)
|
||||
ret.Code = 500
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue