Do not set the default values in the struct we're unmarshaling into
closes pterodactyl/panel#1786 If you set the defaults, you'll override a bunch of values for the server with the original values. For example this code caused servers in a running state to be changed to a non-running state, thus leading to stats not sending. Just merge in any new values, leave everything else as empty.
This commit is contained in:
parent
ea867d16a5
commit
d9ceb9601d
|
@ -3,7 +3,6 @@ package server
|
|||
import (
|
||||
"encoding/json"
|
||||
"github.com/buger/jsonparser"
|
||||
"github.com/creasty/defaults"
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
|
@ -30,11 +29,6 @@ func (s *Server) UpdateDataStructure(data []byte, background bool) error {
|
|||
return errors.New("attempting to merge a data stack with an invalid UUID")
|
||||
}
|
||||
|
||||
// Set the default values in the interface that we unmarshaled into.
|
||||
if err := defaults.Set(src); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
// Merge the new data object that we have received with the existing server data object
|
||||
// and then save it to the disk so it is persistent.
|
||||
if err := mergo.Merge(s, src, mergo.WithOverride); err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user