FEATURE: automatically downsize large images#1
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffbaf8c542
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def self.downsize(from, to, dimensions, opts={}) | ||
| optimize("downsize", from, to, dimensions, opts) |
There was a problem hiding this comment.
Remove duplicate downsize overload to avoid ArgumentError
This new downsize definition overwrites the earlier 4‑argument overload, so any caller still passing max_width, max_height (e.g. Jobs::ResizeEmoji in app/jobs/regular/resize_emoji.rb) will now raise ArgumentError: wrong number of arguments at runtime. This breaks emoji resizing whenever that job runs. Consider keeping a single method that accepts both styles or renaming the new percent/geometry variant to avoid clobbering the existing API.
Useful? React with 👍 / 👎.
| // check file size | ||
| var fileSizeKB = file.size / 1024; | ||
| var maxSizeKB = Discourse.SiteSettings['max_' + type + '_size_kb']; | ||
| var maxSizeKB = 10 * 1024; // 10MB | ||
| if (fileSizeKB > maxSizeKB) { |
There was a problem hiding this comment.
Respect per‑type upload size settings in client validation
The client-side upload validation is now hard‑coded to 10 MB for both images and attachments. If an admin sets max_image_size_kb or max_attachment_size_kb above 10 MB, the UI will block those larger uploads before they reach the server, even though the server would accept them. This is a regression in configured behavior and will prevent legitimate uploads in those deployments.
Useful? React with 👍 / 👎.
Test 1
Replicated from ai-code-review-evaluation/discourse-cursor#1