mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-11-09 00:22:38 -06:00
fix(unsplash): close pingback response body
The pingback discarded the response, leaking the body and its connection on every pingback.
This commit is contained in:
@@ -380,9 +380,12 @@ func pingbackByPhotoID(photoID string) {
|
||||
if err != nil {
|
||||
log.Errorf("Unsplash Pingback Failed: %s", err.Error())
|
||||
}
|
||||
_, err = utils.NewSSRFSafeHTTPClient().Do(req) //nolint:gosec // SSRF protection is handled by the SSRF-safe client
|
||||
resp, err := utils.NewSSRFSafeHTTPClient().Do(req) //nolint:gosec // SSRF protection is handled by the SSRF-safe client
|
||||
if err != nil {
|
||||
log.Errorf("Unsplash Pingback Failed: %s", err.Error())
|
||||
} else {
|
||||
_, _ = io.Copy(io.Discard, resp.Body)
|
||||
_ = resp.Body.Close()
|
||||
}
|
||||
log.Debugf("Pinged unsplash for photo %s", photoID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user