Skip to content

Close Hugging Face scan response body#9818

Merged
mudler merged 1 commit into
mudler:masterfrom
massy-o:codex/close-hf-scan-body
May 14, 2026
Merged

Close Hugging Face scan response body#9818
mudler merged 1 commit into
mudler:masterfrom
massy-o:codex/close-hf-scan-body

Conversation

@massy-o
Copy link
Copy Markdown
Contributor

@massy-o massy-o commented May 14, 2026

Summary

  • close the Hugging Face scan API response body after a successful request

Why

HuggingFaceScan reads the response body but did not close it. Deferring Body.Close() after a successful http.Get releases the underlying connection resources on both success and error status paths.

Testing

  • gofmt -w pkg/downloader/huggingface.go
  • git diff --check

if err != nil {
return nil, err
}
defer results.Body.Close()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: Deferring Body.Close immediately after a successful http.Get ensures the response is released on both the non-200 error path and the normal JSON decode path.

Signed-off-by: massy-o <telitos000@gmail.com>
@massy-o massy-o force-pushed the codex/close-hf-scan-body branch from 99055a8 to 00f54b1 Compare May 14, 2026 10:04
Copy link
Copy Markdown
Owner

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch, good catch

@mudler mudler merged commit 594c9fd into mudler:master May 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants