From 12ed4036c813c8bcbfba76712721f269c0b84aa5 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 19 Oct 2026 14:30:05 +0200 Subject: [PATCH] fix(unsplash): close pingback response body The pingback discarded the response, leaking the body and its connection on every pingback. --- pkg/modules/background/unsplash/unsplash.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/modules/background/unsplash/unsplash.go b/pkg/modules/background/unsplash/unsplash.go index 8de77373e..89d7ebd5c 100644 --- a/pkg/modules/background/unsplash/unsplash.go +++ b/pkg/modules/background/unsplash/unsplash.go @@ -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) }