Fix Hyper3D image upload decoding and URL validation#220
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughMultipart image uploads in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
Review Summary by QodoFix Hyper3D image upload decoding and URL validation
WalkthroughsDescription• Decode base64-encoded image payloads before multipart upload in MAIN_SITE mode • Fix URL validation to check input_image_urls instead of input_image_paths • Add newline at end of file for proper formatting Diagramflowchart LR
A["Image Upload in MAIN_SITE"] -->|base64 decode| B["Multipart Files"]
C["URL Input Branch"] -->|validate URLs| D["URL Validation Check"]
File Changes1. addon.py
|
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/blender_mcp/server.py`:
- Around line 877-878: The current check using urlparse in the input_image_urls
validation always succeeds; update the logic in the function handling
input_image_urls so each URL is parsed with urllib.parse.urlparse and validated
to have a non-empty netloc and a valid scheme (e.g., "http" or "https") and
reject empty strings—replace the all(urlparse(i) for i in input_image_urls)
condition with an explicit loop or comprehension that parses each i, ensures
parsed.scheme in ("http","https") and parsed.netloc, and return the existing
error message if any URL fails this stricter validation.
🪄 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: 6e9352e7-d73a-4c01-a685-ae22daa67a73
📒 Files selected for processing (2)
addon.pysrc/blender_mcp/server.py
Summary
This PR fixes two bugs in the Hyper3D generation flow.
In
MAIN_SITEmode, image data was base64-encoded in the MCP server for transport to theBlender addon, but the addon forwarded that base64 text directly to
requests.post(files=...)instead of decoding it back to raw bytes. This caused invalidmultipart image uploads.
In the
input_image_urlsbranch ofgenerate_hyper3d_model_via_images, the codevalidated
input_image_pathsinstead ofinput_image_urls. When the URL branch was used,this could raise a
TypeErrorinstead of validating the provided URLs.Changes
base64.b64decode(...)before sending multipart files increate_rodin_job_main_siteinput_image_urlsin the URL-input branch ofgenerate_hyper3d_model_via_imagesImpact
MAIN_SITEmodeFAL_AImodeSummary by CodeRabbit
Bug Fixes
Chores