-
-
Notifications
You must be signed in to change notification settings - Fork 323
修复拖拽不符合要求的文件,仍然调用beforeUpload #627
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... 📒 Files selected for processing (1)
Walkthrough本次更改调整了在处理数据传输上传时对可接受文件的筛选逻辑。现在,当不允许多选文件时,将从已通过类型筛选的文件数组中选择第一个文件,而不是原始文件数组,确保文件类型过滤优先于数量限制。此外,新增测试用例验证拖入不被接受类型文件时不会触发上传开始回调。 Changes
Possibly related PRs
Poem
Tip CodeRabbit can approve the review once all CodeRabbit's comments are resolved.Enable the ✨ Finishing Touches
🧪 Generate Unit Tests❌ Error creating Unit Test PR.
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 (
|
需要测试用例。 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #627 +/- ##
=======================================
Coverage 89.10% 89.10%
=======================================
Files 6 6
Lines 303 303
Branches 80 84 +4
=======================================
Hits 270 270
Misses 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
已补充drag unaccepted type files with multiple false to upload will not trigger onStart来测试当multiple=false的时候上传不符合要求的文件不触发onStart事件 |
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.
Pull Request Overview
This PR aims to fix an issue where dragging files that do not meet the acceptance criteria still triggered the beforeUpload callback. The changes include updating the file filtering logic in AjaxUploader to only slice accepted files when multiple file uploads are disabled and adding tests to verify that unaccepted file types do not trigger the onStart callback.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/uploader.spec.tsx | Added a test case for drag-and-drop behavior when files of an unaccepted type are dropped with multiple set to false. |
src/AjaxUploader.tsx | Modified filtering logic to slice the accepted files array instead of the raw files array when multiple is false. |
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Caution No docstrings were generated. |
Co-authored-by: Copilot <[email protected]>
Note Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
expect(mockStart.mock.calls.length).toBe(0); | ||
done(); | ||
}, 100); | ||
}); |
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.
是不是应该检测 beforeUpload 的触发情况?
看 ant-design/ant-design#36318 (comment) 这里的表达,拖拽或选择非 accept 文件也触发 beforeUpload 好像才是符合预期的? |
Summary by CodeRabbit
close ant-design/ant-design#36318