mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-29 04:48:48 +01:00
🎨 Add kernel API /api/file/renameFile https://github.com/siyuan-note/siyuan/issues/8328
This commit is contained in:
parent
5a644cff73
commit
0ef094bc44
1 changed files with 3 additions and 1 deletions
|
|
@ -182,7 +182,6 @@ func renameFile(c *gin.Context) {
|
|||
}
|
||||
|
||||
filePath := arg["path"].(string)
|
||||
newPath := arg["newPath"].(string)
|
||||
filePath = filepath.Join(util.WorkspaceDir, filePath)
|
||||
_, err := os.Stat(filePath)
|
||||
if os.IsNotExist(err) {
|
||||
|
|
@ -195,6 +194,9 @@ func renameFile(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
newPath := arg["newPath"].(string)
|
||||
newPath = filepath.Join(util.WorkspaceDir, newPath)
|
||||
|
||||
if err = filelock.Rename(filePath, newPath); nil != err {
|
||||
logging.LogErrorf("rename file [%s] to [%s] failed: %s", filePath, newPath, err)
|
||||
c.Status(500)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue