-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle nil pointer dereference in Defaulter.getEntitySchema
#904
Conversation
|
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #904 +/- ##
==========================================
- Coverage 35.58% 35.57% -0.01%
==========================================
Files 92 92
Lines 11278 11279 +1
==========================================
Hits 4013 4013
- Misses 6872 6873 +1
Partials 393 393
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking into the test failure..
Due to the nature of the API, I think we should actually do something like this: #869 |
@@ -215,12 +215,15 @@ func (d *Defaulter) getEntitySchema(entityType string) (map[string]interface{}, | |||
return schema, err | |||
} | |||
resp, err := d.client.Do(d.ctx, req, &schema) | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to preserve the behavior described here: https://github.com/Kong/deck/pull/904/files#diff-d85c74f21d13d17a0932f304636914d8aacd18acb50f86632aee600dd1080b20R221
looks like we are receiving a *kong.APIError
with the 404 code, so we could check this instead of checking the resp.StatusCode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GGabriele already has PR up for this that I missed (#869). The Client.Do()
method is hooked up in a bit of an abnormal way, so that threw me for a loop. Closing this PR out as such.
Corrects a nil pointer dereference when
Defaulter.getEntitySchema()
is called & the HTTP request fails.