fix: block import when oversized files exist in upload list#6311
Open
Binx98 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it?
此前,当用户选择的文件超出知识库大小限制时,文件虽然会在上传列表中被标记为错误状态,但并没有拦截用户继续点击「导入」或「下一步」按钮。这导致超限文件仍会被提交到后端,用户体验不够友好。
本 PR 在
UploadComponent.validate()中增加了提交前校验:如果文件列表中存在错误状态(如大小超限)的文件,将拦截本次提交,并弹出简洁的提示(如「每个文件不超过 100MB」),不列出具体文件名。Summary of your change
ui/src/views/document/upload/UploadComponent.vuevalidate()函数中新增前置检查,遍历fileList查找status === 'error'的文件项;若存在则触发MsgError提示,并返回Promise.resolve(false)中断提交流程。