Skip to content

Commit 0afedca

Browse files
committed
fix(QFile): Allow both array and single file model for interoperation with QField type file
1 parent d79c61e commit 0afedca

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ui/src/components/file/QFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export default Vue.extend({
4444

4545
computed: {
4646
innerValue () {
47-
return this.value !== void 0 && this.value !== null
48-
? (this.multiple === true ? Array.from(this.value) : [ this.value ])
47+
return Object(this.value) === this.value
48+
? ('length' in this.value ? Array.from(this.value) : [ this.value ])
4949
: []
5050
},
5151

ui/src/mixins/file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
},
4141

4242
__processFiles (e, files) {
43-
files = Array.prototype.slice.call(files || e.target.files)
43+
files = Array.from(files || e.target.files)
4444

4545
// filter file types
4646
if (this.accept !== void 0) {
@@ -145,10 +145,10 @@ export const FileValueMixin = {
145145
: void 0
146146
)
147147

148-
if (this.value !== void 0 && this.value !== null) {
148+
if (Object(this.value) === this.value) {
149149
('length' in this.value
150-
? Array.prototype.slice.call(this.value)
151-
: [this.value]
150+
? Array.from(this.value)
151+
: [ this.value ]
152152
).forEach(file => {
153153
dt.items.add(file)
154154
})

0 commit comments

Comments
 (0)