Skip to content

Commit

Permalink
Safari 11 duplicate file fix
Browse files Browse the repository at this point in the history
Added changes from PR described in blueimp#3512 (comment)
  • Loading branch information
david-hollifield committed Feb 22, 2019
1 parent a47513f commit bb0a821
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions js/jquery.fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -1173,10 +1173,10 @@
$.map(entries, function (entry) {
return that._handleFileTreeEntry(entry, path);
})
).then(function () {
).then(function (entries) {
return Array.prototype.concat.apply(
[],
arguments
entries
);
});
},
Expand Down Expand Up @@ -1208,16 +1208,9 @@

_getSingleFileInputFiles: function (fileInput) {
fileInput = $(fileInput);
var entries = fileInput.prop('webkitEntries') ||
fileInput.prop('entries'),
files,
value;
if (entries && entries.length) {
return this._handleFileTreeEntries(entries);
}
files = $.makeArray(fileInput.prop('files'));
var files = $.makeArray(fileInput.prop('files'));
if (!files.length) {
value = fileInput.prop('value');
var value = fileInput.prop('value');
if (!value) {
return $.Deferred().resolve([]).promise();
}
Expand All @@ -1242,10 +1235,10 @@
return $.when.apply(
$,
$.map(fileInput, this._getSingleFileInputFiles)
).then(function () {
).then(function (files) {
return Array.prototype.concat.apply(
[],
arguments
files
);
});
},
Expand All @@ -1257,7 +1250,7 @@
form: $(e.target.form)
};
this._getFileInputFiles(data.fileInput).always(function (files) {
data.files = files;
data.files = $.makeArray(files);
if (that.options.replaceFileInput) {
that._replaceFileInput(data);
}
Expand Down

0 comments on commit bb0a821

Please sign in to comment.