fix: get the supported format properly#53
Conversation
|
Warning Review limit reached
More reviews will be available in 50 minutes and 32 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR centralizes image format resolution by introducing ChangesImage Format Resolution Consolidation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🤖 Pull request artifacts
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/shared/converters/image-converter.js`:
- Around line 12-20: Normalize the incoming formatString inside
getSupportedFormat by trimming and lowercasing it, map common JPEG aliases
("jpg", "image/jpg") to the canonical "jpeg" before lookup, then perform the
existing MIME/value matching against supportedFormats (use supportedFormats.find
by mimeType or value) and fall back to supportedFormats[0] if nothing matches;
update getSupportedFormat to handle non-string inputs robustly (default to empty
string) and ensure comparisons are case-insensitive so convert() receives the
correct format metadata.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4c6b2ad2-d51f-4350-afba-3c0803315a85
📒 Files selected for processing (1)
src/shared/converters/image-converter.js
fixes #52
Issue was the previous
formatTovariable in line 231 filters outimage/heicbut notheic. The additional helper function ensures format mime type or value is properly used.This issue is discovered because when WordPress converts HEIC to JPG (tested also when Cimo is disabled), the file's metadata still contains the file type as HEIC. And since Bulk Optimization converts with the same output format as the input, it tries to convert to HEIC.
Summary by CodeRabbit
Release Notes