-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 bug: Fix square bracket notation in Multipart FormData #3235
base: main
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@gaby has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 58 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes in this pull request enhance the multipart form data handling in the Changes
Assessment against linked issues
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3235 +/- ##
==========================================
- Coverage 82.86% 82.72% -0.15%
==========================================
Files 115 115
Lines 11295 11311 +16
==========================================
- Hits 9360 9357 -3
- Misses 1537 1555 +18
- Partials 398 399 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
bind_test.go
(4 hunks)binder/form.go
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
binder/form.go
[warning] 60-67: binder/form.go#L60-L67
Added lines #L60 - L67 were not covered by tests
[warning] 70-77: binder/form.go#L70-L77
Added lines #L70 - L77 were not covered by tests
🪛 golangci-lint (1.62.2)
bind_test.go
998-998: Error return value of writer.WriteField
is not checked
(errcheck)
999-999: Error return value of writer.WriteField
is not checked
(errcheck)
1000-1000: Error return value of writer.Close
is not checked
(errcheck)
1019-1019: Error return value of writer.WriteField
is not checked
(errcheck)
1020-1020: Error return value of writer.WriteField
is not checked
(errcheck)
1021-1021: Error return value of writer.Close
is not checked
(errcheck)
[warning] 1238-1238: unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField
(revive)
1238-1238: Error return value of writer.WriteField
is not checked
(errcheck)
[warning] 1240-1240: unhandled-error: Unhandled error in call to function mime/multipart.Writer.Close
(revive)
1240-1240: Error return value of writer.Close
is not checked
(errcheck)
[warning] 1278-1278: unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField
(revive)
1278-1278: Error return value of writer.WriteField
is not checked
(errcheck)
[warning] 1279-1279: unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField
(revive)
1279-1279: Error return value of writer.WriteField
is not checked
(errcheck)
[warning] 1280-1280: unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField
(revive)
[warning] 1281-1281: unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField
(revive)
[warning] 1282-1282: unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField
(revive)
[warning] 1284-1284: unhandled-error: Unhandled error in call to function mime/multipart.Writer.Close
(revive)
🪛 GitHub Check: lint
bind_test.go
[failure] 998-998:
Error return value of writer.WriteField
is not checked (errcheck)
[failure] 999-999:
Error return value of writer.WriteField
is not checked (errcheck)
[failure] 1000-1000:
Error return value of writer.Close
is not checked (errcheck)
[failure] 1019-1019:
Error return value of writer.WriteField
is not checked (errcheck)
[failure] 1020-1020:
Error return value of writer.WriteField
is not checked (errcheck)
[failure] 1021-1021:
Error return value of writer.Close
is not checked (errcheck)
[failure] 1238-1238:
unhandled-error: Unhandled error in call to function mime/multipart.Writer.WriteField (revive)
[failure] 1238-1238:
Error return value of writer.WriteField
is not checked (errcheck)
[failure] 1240-1240:
unhandled-error: Unhandled error in call to function mime/multipart.Writer.Close (revive)
[failure] 1240-1240:
Error return value of writer.Close
is not checked (errcheck)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
bind_test.go (2)
992-1032
: LGTM! Consider adding edge cases.The new test cases effectively validate both dot notation and square bracket syntax for multipart form data binding. The tests are well-structured and consistent with the existing test patterns.
Consider adding test cases for:
- Empty arrays
- Invalid indices
- Mixed notation (e.g.,
data[0].name
anddata.1[name]
)- Special characters in field names
Line range hint
992-1302
: Overall implementation looks solidThe implementation successfully adds support for square bracket notation in multipart binding while maintaining compatibility with dot notation. The test coverage is good, though it could be expanded to cover more edge cases. The benchmarks provide performance validation but need the variable fixes mentioned above.
Since this feature provides two different notations for the same functionality, consider:
- Documenting the preferred notation in comments
- Adding examples in the test file showing when to use each notation
- Ensuring consistent performance between both notations through benchmarks
🧰 Tools
🪛 GitHub Check: unit (1.23.x, macos-13)
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t🪛 GitHub Check: unit (1.23.x, macos-latest)
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t🪛 GitHub Check: unit (1.23.x, ubuntu-latest)
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t🪛 GitHub Check: lint
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t (typecheck)
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
bind_test.go
(4 hunks)
🧰 Additional context used
🪛 GitHub Check: unit (1.23.x, macos-13)
bind_test.go
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
🪛 GitHub Check: unit (1.23.x, macos-latest)
bind_test.go
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t
🪛 GitHub Check: unit (1.23.x, ubuntu-latest)
bind_test.go
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
🪛 GitHub Check: lint
bind_test.go
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
[failure] 1277-1277:
undefined: t
[failure] 1278-1278:
undefined: t
[failure] 1279-1279:
undefined: t
[failure] 1280-1280:
undefined: t
[failure] 1281-1281:
undefined: t
[failure] 1282-1282:
undefined: t (typecheck)
[failure] 1238-1238:
undefined: t
[failure] 1239-1239:
undefined: t
@efectn Analysis by Key Issues Identified:
Summary of Primary Concerns:
|
Description
Fixes #3224
Will be backporting to v2 after the PR is get merged
Type of change
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md