Skip to content
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

fix: 修复文件配置全没勾选的情况下还能上传文件的问题 #1702

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

shaohuzhang1
Copy link
Contributor

fix: 修复文件配置全没勾选的情况下还能上传文件的问题 --bug=1049620 --user=刘瑞斌 【应用编排】文件上传设置没勾选文档也没勾选图片,发布后对话还是能上传文档和图片 https://www.tapd.cn/57709429/s/1618519

--bug=1049620 --user=刘瑞斌 【应用编排】文件上传设置没勾选文档也没勾选图片,发布后对话还是能上传文档和图片 https://www.tapd.cn/57709429/s/1618519
Copy link

f2c-ci-robot bot commented Nov 27, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Nov 27, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -217,6 +217,9 @@ const getAcceptList = () => {
accepts = [...accepts, ...videoExtensions]
}
// console.log(accepts)
if (accepts.length === 0) {
return '.请在文件上传配置中选择文件类型'
}
return accepts.map((ext: any) => '.' + ext).join(',')
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码看起来是一段用于处理文件上传时需要接受的扩展名的JavaScript函数。然而,在提供的两个版本之间没有明显的差异,似乎只是简单地增加了videoExtensions数组的内容并返回其转义后的字符串。

这个实现功能基本准确,但由于缺少注释和描述性的文档(如用途、输入参数示例以及正确情况下的预期输出等),可能难以理解或维护。

因此,我给出的修改建议是补充一些基本信息:

  • 增加注释以解释变量含义,
  • 更好地对传入值做限制或校验(例如使用类型断言来确保所有的字符串都是可读的字符)。

具体来说,可以按照以下方式改动此部分代码:

/**
 * @description 得到允许使用的拓展名列表,如果该列表为空,则提供默认提示信息。
 * @returns 简要的用户指南:若指定的文件扩展现已过期,应重新选择其他兼容性更好的文件类型。"
 */
const acceptLst = (e: React.FormEvent<HTMLInputElement>) => {

此外,请根据您的需求或API的实际行为调整上述内容中的相关函数,并参考最佳实践添加必要的逻辑断言语句以提高代码阅读性和可读性。

@liuruibin liuruibin merged commit b790519 into main Nov 27, 2024
4 checks passed
@liuruibin liuruibin deleted the pr@main@fix_doc_error21 branch November 27, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants