DeepSeek V4.1 Flash · Heavy
feature-automatically-downsize-large-images-discourse-cursor
Discourse · Ruby · S · 30–99 lines · 3 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 3 of 8
- Comments published
- 5
- Comments matching a bug
- 3
- Comments not matching
- 2
- Cost of this PR
- $0.192
Published comments (5)
Downsize tempfile path lacks extension, collapsing animated GIFs — Without an extension, `file.tempfile.path` fails `optimize`'s `.GIF` check, so `allow_animation` does nothing and every animated GIF is collapsed to one frame. Copy the tempfile to a path carrying the original extension (as `OptimizedImage.create_for` does) before downscaling, then convert back.
API upload URL download uses hardcoded 10 MB cap instead of site settings — Hardcoding the ceiling lets any API upload URL, even non-images `FileHelper.is_image?` excludes, force a 10 MB fetch despite a smaller configured limit. Derive the cap from `SiteSetting.max_image_size_kb` and `SiteSetting.max_attachment_size_kb` instead of a constant.
New `downsize` definition shadows width/height version and breaks caller — The `downsize` call in `app/jobs/regular/resize_emoji.rb` still passes five positional arguments to the new 3-4 arity, raising `ArgumentError` and leaving emoji un-resized. Update that caller to the `"100x100"` dimension-string form, or keep a width/height-compatible method name.
Client upload size check hardcodes 10MB instead of using configured site setting — Hardcoding 10 MB desyncs the client from the server, which still enforces `SiteSetting.max_image_size_kb`, so attachments pass client-side then fail server-side. Drive the check from the same `Discourse.SiteSettings['max_' + type + '_size_kb']` setting the server uses.
Downsizing loop ignores OptimizedImage.downsize failure — When `OptimizedImage.downsize` fails, all five full convert passes still run synchronously, multiplying CPU cost with no size reduction. Break out of the loop when `downsize` returns false.