Skip to content

Commit 963d478

Browse files
impowskitmorehouse
authored andcommitted
fix(form-file): issue with "accept" values [fixes #1526, reverts #2028] (#2008)
fix(form-file): issue with "accept" values (fixes #1526, reverts #2028)
1 parent 29b563a commit 963d478

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/components/form-file/form-file.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,18 @@ export default {
183183
setFiles (files) {
184184
if (!files) {
185185
this.selectedFile = null
186-
return
187-
}
188-
if (!this.multiple) {
189-
let firstElement = files[0]
190-
if (firstElement.type.match(this.accept)) {
191-
this.selectedFile = firstElement
192-
}
193-
return
194-
}
195-
// Convert files to array
196-
const filesArray = []
197-
for (let i = 0; i < files.length; i++) {
198-
if (files[i].type.match(this.accept)) {
186+
} else if (this.multiple) {
187+
// Convert files to array
188+
const filesArray = []
189+
for (let i = 0; i < files.length; i++) {
199190
filesArray.push(files[i])
200191
}
192+
// Return file(s) as array
193+
this.selectedFile = filesArray
194+
} else {
195+
// Return single file object
196+
this.selectedFile = files[0]
201197
}
202-
this.selectedFile = filesArray
203198
},
204199
dragover (evt) {
205200
evt.preventDefault()

0 commit comments

Comments
 (0)