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

View file

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