Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Addresses PR review feedback on DownloadImage and DownloadThumbnail methods.

Changes

  • HTTP timeout: Added 30-second default timeout via newHTTPClient() to prevent indefinite hangs
  • Test fix: Removed io.NopCloser wrapper from failingBody tests—was silently preventing close error testing
  • Typo fix: Corrected "thums" → "thumb" in thumbnail filename suffix and variable names
  • Test cleanup: Consolidated duplicate image helpers into makeImageBytes(w, h, format, r, g, b), removed incomplete TestDownloadImage_CloseErrorJoined

Example

// Before: close errors never triggered because io.NopCloser provides no-op Close()
Body: io.NopCloser(b)

// After: failingBody.Close() error properly propagates
Body: b
// Before: no timeout, could hang indefinitely
fetch.New(fetch.WithHTTPClient(&http.Client{}))

// After: 30s timeout by default
var newHTTPClient = func() *http.Client {
    return &http.Client{Timeout: 30 * time.Second}
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.invalid
    • Triggering command: /tmp/go-build1542384166/b001/webinfo.test /tmp/go-build1542384166/b001/webinfo.test -test.testlogfile=/tmp/go-build1542384166/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
    • Triggering command: /tmp/go-build2343132928/b001/webinfo.test /tmp/go-build2343132928/b001/webinfo.test -test.testlogfile=/tmp/go-build2343132928/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s (dns block)
    • Triggering command: /tmp/go-build1752668271/b001/webinfo.test /tmp/go-build1752668271/b001/webinfo.test -test.testlogfile=/tmp/go-build1752668271/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Refactor DownloadImage and DownloadThumbnail methods for improved error handling and file management Fix review comments: remove io.NopCloser wrapper, add HTTP timeout, fix typos Nov 28, 2025
@spiegel-im-spiegel spiegel-im-spiegel marked this pull request as ready for review November 28, 2025 05:51
@spiegel-im-spiegel spiegel-im-spiegel merged commit 0c0b20b into develop Nov 28, 2025
1 check passed
@spiegel-im-spiegel spiegel-im-spiegel deleted the copilot/sub-pr-2 branch November 28, 2025 05:52
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