Merge branch 'develop' of https://github.com/pterodactyl/wings into develop

This commit is contained in:
Dane Everitt
2020-12-25 13:57:33 -08:00
3 changed files with 39 additions and 5 deletions

View File

@@ -441,6 +441,8 @@ type chmodFile struct {
Mode string `json:"mode"`
}
var errInvalidFileMode = errors.New("invalid file mode")
func postServerChmodFile(c *gin.Context) {
s := GetServer(c.Param("server"))
@@ -472,7 +474,7 @@ func postServerChmodFile(c *gin.Context) {
default:
mode, err := strconv.ParseUint(p.Mode, 8, 32)
if err != nil {
return err
return errInvalidFileMode
}
if err := s.Filesystem().Chmod(path.Join(data.Root, p.File), os.FileMode(mode)); err != nil {
@@ -491,6 +493,13 @@ func postServerChmodFile(c *gin.Context) {
}
if err := g.Wait(); err != nil {
if errors.Is(err, errInvalidFileMode) {
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{
"error": "Invalid file mode.",
})
return
}
NewServerError(err, s).AbortFilesystemError(c)
return
}

View File

@@ -326,6 +326,7 @@ func postTransfer(c *gin.Context) {
} else {
i.Server().SetTransferring(false)
i.Server().Events().Publish(server.TransferStatusEvent, "success")
sendTransferLog("Transfer completed.")
}
}(i.Server())
@@ -449,8 +450,9 @@ func postTransfer(c *gin.Context) {
// It may be useful to retry sending the transfer success every so often just in case of a small
// hiccup or the fix of whatever error causing the success request to fail.
hasError = false
data.log().Info("archive transfered successfully, notifying panel of status")
sendTransferLog("Archive transfered successfully.")
data.log().Info("archive transferred successfully, notifying panel of status")
sendTransferLog("Archive transferred successfully.")
}(&data)
c.Status(http.StatusAccepted)