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

文件格式错误时候打印文件属性,方便调试 #146

Open
zhn4 opened this issue Apr 4, 2020 · 0 comments
Open

文件格式错误时候打印文件属性,方便调试 #146

zhn4 opened this issue Apr 4, 2020 · 0 comments

Comments

@zhn4
Copy link

zhn4 commented Apr 4, 2020

Is your feature request related to a problem? Please describe.
业务使用 upload-to-ali 上传 ios 的 P12 证书以及 mobileprovision 描述文件,遇到设置 accept 的问题,accept = ‘application/*’ 不能解决文件类型问题。需要自己另外写 js 解析文件类型,有点麻烦

Describe the solution you'd like
在源码内判断文件类型的函数内加入一个 console 打印 files 方便开发者知道罕见文件的类型

if (
        this.accept &&
        (this.accept.indexOf('/*') > -1
          ? files.some(
              i => i.type.indexOf(this.accept.match(mimeTypeHalfRegex)) === -1
            )
          : files.some(i => this.accept.indexOf(i.type) === -1))
      ) {
        console.log(files) // 这里
        alert('文件格式有误!')
        reset()
        return
      }

最终效果
WechatIMG262.png

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

No branches or pull requests

1 participant