Skip to content

Upload组件中,图片的URL后缀名为.do类型的时候,显示框的icon是一个file icon,而不是图片的缩略图 #1766

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

Closed
1 task done
chengzhiping opened this issue Feb 9, 2020 · 2 comments
Labels

Comments

@chengzhiping
Copy link

chengzhiping commented Feb 9, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.4.10

Environment

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36

Reproduction link

https://github.com/vueComponent/ant-design-vue.git

Steps to reproduce

在给Upload组件传值defaultFileList对象中设置url为.do类型的后缀名(非常规的jpg, jpeg, gif等等后缀名)时,代码如下
<a-upload
.....
:defaultFileList="fileList"

export default {
data() {
return {
fileList: [
{
uid: '-1',
name: 'xxx.png',
status: 'done',
url: 'xxx.do',
}
],
};
},
};

What is expected?

期望能正常显示图片

What is actually happening?

图片显示为一个file icon。而不是图片。


查找到是在这个文件中/ant-design-vue/es/upload/UploadList.js中isImageUrl方法中会检测图片url的后缀名,如果不是常规图片后缀名,return false, 但是图片中也有一种形式,通过后端.do接口返回数据流。而数据流是图片。这里可以改造或者可配置?

@chengzhiping
Copy link
Author

传递file的type为image即可解决

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant