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: upload 识别图片类型逻辑错误 #21473

Merged
merged 2 commits into from
Feb 19, 2020
Merged

fix: upload 识别图片类型逻辑错误 #21473

merged 2 commits into from
Feb 19, 2020

Conversation

holynewbie
Copy link
Contributor

@holynewbie holynewbie commented Feb 19, 2020

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 组件样式改进
  • TypeScript 定义更新
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

需求背景:当上传的文件为非图片,且服务端返回的资源链接不具有扩展名时,UploadList 依然会将该文件识别为图片,并导致渲染的预览图出错。
解决方案:在判断文件是否为图片时,如果有文件类型 (type),则直接依据类型作出判断。

📝 更新日志怎么写?

语言 更新描述
🇺🇸 英文 fix uploaded file type detection
🇨🇳 中文 修复上传文件类型判断错误
  • 中文(可选):

☑️ 请求合并前的自查清单

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

当 uploadFile 有类型时,直接对 类型 进行判断即可
@ant-design-bot
Copy link
Contributor

ant-design-bot commented Feb 19, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 19, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@codecov
Copy link

codecov bot commented Feb 19, 2020

Codecov Report

Merging #21473 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21473   +/-   ##
=======================================
  Coverage   97.83%   97.83%           
=======================================
  Files         302      302           
  Lines        7016     7016           
  Branches     1923     1933   +10     
=======================================
  Hits         6864     6864           
  Misses        152      152
Impacted Files Coverage Δ
components/upload/utils.tsx 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18d2f04...27c49b2. Read the comment docs.

@afc163 afc163 merged commit c968184 into ant-design:master Feb 19, 2020
@pr-triage pr-triage bot added the PR: merged label Feb 19, 2020
@ycjcl868 ycjcl868 mentioned this pull request Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants