fix: curl import with --data-binary and json content-type crashes#7880
fix: curl import with --data-binary and json content-type crashes#7880desperadoxhy wants to merge 1 commit intousebruno:mainfrom
Conversation
When importing a curl command that uses `--data-binary` with `application/json` content-type, the parser incorrectly treated it as a file upload (body.mode = 'file') before checking the content-type. This caused `e.file?.map is not a function` because the Redux store expects body.file to be an array. The `--data-binary` flag in curl controls data transmission, not body type. Remove the premature isDataBinary check so content-type-based detection (json, xml, form, etc.) takes priority. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Summary
e.file?.map is not a function) when importing a curl command that uses--data-binarywithapplication/jsoncontent-type--data-binaryas a file upload before checking content-type, causing the Redux store to call.map()on a string valueProblem
When importing this curl command:
The
--data-binaryflag caused the parser to setbody.mode = 'file'andbody.file = parsedBody(a JSON string), skipping the content-type check entirely. The Redux store then crashed because it expectedbody.fileto be an array.Fix
Removed the premature
request.isDataBinarycheck so that content-type-based detection (application/json→ json mode, etc.) takes priority. The--data-binaryflag in curl controls data transmission behavior, not the body type.Test plan
--data-binary+application/jsoncontent-type → correctly parsed as JSON body--data-binary+application/xmlcontent-type → correctly parsed as XML body--data-binary→ unaffected🤖 Generated with Claude Code
Summary by CodeRabbit