mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-04 17:06:49 +00:00
More work to support nullable foreign keys
Adds nullable int/uint types
This commit is contained in:
@ -148,7 +148,7 @@ func getCertificateFromRequest(w http.ResponseWriter, r *http.Request) *certific
|
||||
return nil
|
||||
}
|
||||
|
||||
// getCertificateFromRequest has some reusable code for all endpoints that
|
||||
// fillObjectFromBody has some reusable code for all endpoints that
|
||||
// have a certificate id in the url. it will write errors to the output.
|
||||
func fillObjectFromBody(w http.ResponseWriter, r *http.Request, validationSchema string, o interface{}) bool {
|
||||
bodyBytes, _ := r.Context().Value(c.BodyCtxKey).([]byte)
|
||||
@ -167,6 +167,7 @@ func fillObjectFromBody(w http.ResponseWriter, r *http.Request, validationSchema
|
||||
|
||||
err := json.Unmarshal(bodyBytes, o)
|
||||
if err != nil {
|
||||
logger.Debug("Unmarshal Error: %+v", err)
|
||||
h.ResultErrorJSON(w, r, http.StatusBadRequest, h.ErrInvalidPayload.Error(), nil)
|
||||
return false
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func CreateHost() func(http.ResponseWriter, *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if newHost.UpstreamID > 0 {
|
||||
if newHost.UpstreamID.Uint > 0 {
|
||||
// nolint: errcheck, gosec
|
||||
newHost.Expand([]string{"upstream"})
|
||||
}
|
||||
|
Reference in New Issue
Block a user