Conversation
…RLImageSegment and BytesImageSegment\n- Write temp image files with automatic cleanup\n- Extend InputSegment with cleanup hook\n- Update normalizeInput to collect cleanups and expose a cleanup function
…pared.cleanup() on error and via defer to avoid leaking temp files\n- Rename schema cleanup var to avoid shadowing and ensure proper ordering
…behavior\n\n- Download and cleanup test using httptest server\n- Validate non-image content-type is rejected\n- Ensure bytes segment picks a .png extension and cleans up
…e\n\n- Rename section to include remote and in-memory images\n- Add examples for URLImageSegment and BytesImageSegment with cleanup behavior explained
input.go
Outdated
| return InputSegment{}, fmt.Errorf("download image: content-type %q is not an image", mediaType) | ||
| } | ||
|
|
||
| data, err := io.ReadAll(resp.Body) |
There was a problem hiding this comment.
URLImageSegment currently slurps the entire response into memory via io.ReadAll. Because the helper is intended for arbitrary remote URLs, a large or malicious server response can easily exhaust memory and make the process unstable. Please stream the download to disk (or at least cap the bytes you buffer up front for type sniffing) instead of reading the full body into RAM.
Codex Review SummaryRecommendation: ✅ Ready to merge – no blocking issues detected. Summary: Inline findings:
Generated at 2025-11-06T19:43:29.925Z. |
Summary
Changes
Notes
closes #12