This commit is contained in:
Daniel 2023-05-23 09:10:06 +08:00
parent 0ef094bc44
commit 8c843f8775
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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
}
}