Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Add kernel API `/api/file/renameFile` https://github.com/siyuan-note/siyuan/issues/8328

Daniel8c843f8775a7
diff --git a/kernel/api/file.go b/kernel/api/file.go
index ea32cb6972..df8b6d5d39 100644
--- a/kernel/api/file.go
+++ b/kernel/api/file.go
@@ -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
}
}