Skip to content

Commit

Permalink
fix(QFile, QUploader): accept any file if there is '*' or '*/*' in th…
Browse files Browse the repository at this point in the history
…e accept prop #7166 (#7377)
  • Loading branch information
pdanpdan authored Jul 10, 2020
1 parent b8e2a31 commit 42bffa9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/src/mixins/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export default {
if (this.accept !== void 0) {
return this.accept.split(',').map(ext => {
ext = ext.trim()
// support "image/*"
if (ext.endsWith('/*')) {
if (ext === '*') { // support "*"
return '*/'
} else if (ext.endsWith('/*')) { // support "image/*" or "*/*"
ext = ext.slice(0, ext.length - 1)
}
return ext.toUpperCase()
Expand Down Expand Up @@ -75,7 +76,7 @@ export default {
}

// filter file types
if (this.accept !== void 0) {
if (this.accept !== void 0 && this.extensions.indexOf('*/') === -1) {
files = filterFiles(files, rejectedFiles, 'accept', file => {
return this.extensions.some(ext => (
file.type.toUpperCase().startsWith(ext) ||
Expand Down

0 comments on commit 42bffa9

Please sign in to comment.