MiniMax M3 · 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
3
Comments matching a bug
3
Comments not matching
0
Cost of this PR
$0.268

Published comments (3)

highbugapp/models/optimized_image.rb:149-151

Duplicate downsize redefines signature and breaks ResizeEmoji caller — Every `ResizeEmoji` job raises `ArgumentError` because the duplicate `downsize(from, to, dimensions, opts={})` shadows the 5-arg signature used at `app/jobs/regular/resize_emoji.rb:14`. Remove the obsolete first definition so the new contract is unambiguous.

highbugapp/controllers/uploads_controller.rb:63-70

OptimizedImage.downsize called with a percentage string after signature change — `OptimizedImage.downsize` receives `"80%"` here while the new signature expects a `"WxH"` pixel string, breaking the resize loop. Add a `downsize_percentage` helper or convert the source resolution into `"WxH"` before calling.

mediumbugapp/assets/javascripts/discourse/lib/utilities.js:180-185

validateUploadedFile hardcodes 10MB, ignoring per-type SiteSetting limit — `validateUploadedFile` runs for both image and attachment uploads, so a hardcoded `10 * 1024` discards `SiteSetting.max_attachment_size_kb` client-side and users only learn the cap when the server rejects the upload. Restore the `Discourse.SiteSettings['max_' + type + '_size_kb']` lookup or only apply 10MB for images.

Gold bugs found (3)

highdownsize is defined twice in OptimizedImage; the new (from, to, dimensions, opts) version overrides the (max_width, max_height) one, so existing callers such as ResizeEmoji that pass width and height now raise ArgumentError.
highThe client-side upload size check hardcodes 10 MB instead of the per-type max_<type>_size_kb setting, so attachment limits diverge from the server: larger allowed attachments are blocked and smaller limits are only enforced server-side.
highThe upload downsizing passes a percentage ('80%') as dimensions, but for animated GIFs the gifsicle path uses --resize-fit, which expects WxH geometry, so downsizing silently fails.

Gold bugs missed (5)

mediumAuto-downsizing passes the upload tempfile path, which lacks a .gif extension, so the animated branch is never chosen and convert keeps only the first frame, flattening oversized animated GIFs.
highClaims the downsize loop checking tempfile.size may never terminate because of a stale cached size, causing infinite loops.
highOversized SVG uploads go through the new ImageMagick downsize loop because SVG counts as an image, so the vector file is rasterized or corrupted in place before Upload.create_for parses it as SVG.
criticalThe upload tempfile path, which for API URL uploads embeds the request-controlled type param, is now passed to OptimizedImage.downsize and run unescaped in a shell via backticks, allowing command injection through type.
mediumThe 413 upload error message states a hard-coded 10 MB maximum that may not match the limit the server or web server actually enforces.