Repository navigation
fix(image): normalize JPEG MIME and infer reference image types - #330
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughKira AI image tags no longer infer MIME types from reference image extensions or pass MIME metadata to ChangesImage MIME handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Reference-image uploads retain their detected supported format, and JPEG aliases are canonicalized. No actionable merge-blocking risk is identified. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Reference-image handling can now send some non-image local files to an external image provider. The exposure depends on image generation being enabled and a reference path being selected, but it warrants a security design review. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. A rabbit checks the image trail Comment |
Summary
Fix reference-image generation failing with
Unsupported image MIME type: image/jpgafter #328. The<img>and<selfie>tags constructed MIME types directly from filename extensions, bypassing the content inference added in #315. JPEG references now useimage/jpeg, and reference images with misleading or missing extensions use the existing content detection.Type of change
Changes
<img>and<selfie>reference images use the existingImageMIME inference instead of explicitly assigningimage/<extension>.image/jpgtoimage/jpegbefore OpenAI edit-upload validation so externally supplied Data URLs and explicit MIME values remain compatible.Image.to_data_url()→ image providers, and OpenAI image-edit upload conversion. Text-to-image behavior is unchanged. Unsupported image types and malformed Base64 remain rejected by the existing validation.Screenshots / Logs
Before: a
.jpgreference from<img>or<selfie>producedimage/jpgand was rejected before reaching the image-edit API.After: tag inputs use content inference, and OpenAI uploads accept the JPEG alias while sending canonical
image/jpeg.Regression validation on
dev, using the host Python environment:The warning is an existing Authlib deprecation warning.
git diff --check origin/dev...HEADpassed. API calls were mocked; live image generation was not exercised. Regression risks are MIME selection for reference-image tags and upload validation; related media conversion, storage, compression, file-tag, and OpenAI tests passed.Checklist
requirements.txt(if applicable) — no new dependenciesSummary by CodeRabbit
image/jpgorimage/JPGare now recognized as JPEG and uploaded with the correct JPEG format. Existingimage/jpeginputs continue to work.