-
Notifications
You must be signed in to change notification settings - Fork 7.8k
fix: requestClient.upload会将vbenform中value为undefined的值转为字符串undefined’提… #6300
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
Conversation
|
WalkthroughThe update refines the file upload logic by ensuring that only defined values are appended to the FormData object. This is achieved by importing and utilizing an Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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: 0
🧹 Nitpick comments (1)
packages/effects/request/src/request-client/modules/uploader.ts (1)
26-26
: Excellent fix for the undefined string conversion issue.This change correctly prevents
undefined
values from being converted to the string "undefined" when appended to FormData, which directly addresses the issue described in the PR objectives.Consider array elements for consistency:
While this fix addresses the main issue, note that array elements could also be
undefined
and would still be appended as "undefined" strings (lines 22-24). Consider whether similar checking should be applied there for consistency:value.forEach((item, index) => { - formData.append(`${key}[${index}]`, item); + !isUndefined(item) && formData.append(`${key}[${index}]`, item); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/effects/request/src/request-client/modules/uploader.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/effects/request/src/request-client/modules/uploader.ts (1)
packages/@core/base/shared/src/utils/inference.ts (1)
isUndefined
(162-162)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Check (ubuntu-latest)
- GitHub Check: Lint (ubuntu-latest)
- GitHub Check: Lint (windows-latest)
- GitHub Check: Check (windows-latest)
- GitHub Check: Test (windows-latest)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: post-update (windows-latest)
- GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (1)
packages/effects/request/src/request-client/modules/uploader.ts (1)
4-4
: LGTM: Clean import of utility function.The import correctly brings in the
isUndefined
utility function that will be used to filter out undefined values before appending to FormData.
完善一下 |
哪里还需要改? |
@zwtvip ai提示的 数组内可能存在undefine |
已处理 |
表单格式提交,vbenform中未赋值的话,默认是undefined,这会导致 form.append会将undefined 转为字符串‘undefined’ 提交给后台保存到数据库
Summary by CodeRabbit