Only create the directory structure if it is a file being renamed; closes pterodactyl/panel#2292

This commit is contained in:
Dane Everitt
2020-08-31 21:02:06 -07:00
parent cbf914e7a1
commit 481df3d543
2 changed files with 21 additions and 9 deletions

View File

@@ -149,6 +149,13 @@ func putServerRenameFiles(c *gin.Context) {
}
if err := g.Wait(); err != nil {
if errors.Is(err, os.ErrExist) {
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{
"error": "Cannot move or rename file, destination already exists.",
})
return
}
TrackedServerError(err, s).AbortWithServerError(c)
return
}