Skip to content

Commit 84a69fd

Browse files
committed
Update jQuery File Upload Processing Plugin to 1.3.0
1 parent 08009b6 commit 84a69fd

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-process.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Processing Plugin 1.1
2+
* jQuery File Upload Processing Plugin 1.3.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2012, Sebastian Tschan
@@ -9,8 +9,8 @@
99
* http://www.opensource.org/licenses/MIT
1010
*/
1111

12-
/*jslint nomen: true, unparam: true */
13-
/*global define, window */
12+
/* jshint nomen:false */
13+
/* global define, window */
1414

1515
(function (factory) {
1616
'use strict';
@@ -64,13 +64,17 @@
6464
*/
6565
},
6666

67-
_processFile: function (data) {
67+
_processFile: function (data, originalData) {
6868
var that = this,
6969
dfd = $.Deferred().resolveWith(that, [data]),
7070
chain = dfd.promise();
7171
this._trigger('process', null, data);
7272
$.each(data.processQueue, function (i, settings) {
7373
var func = function (data) {
74+
if (originalData.errorThrown) {
75+
return $.Deferred()
76+
.rejectWith(that, [originalData]).promise();
77+
}
7478
return that.processActions[settings.action].call(
7579
that,
7680
data,
@@ -98,14 +102,20 @@
98102
_transformProcessQueue: function (options) {
99103
var processQueue = [];
100104
$.each(options.processQueue, function () {
101-
var settings = {};
105+
var settings = {},
106+
action = this.action,
107+
prefix = this.prefix === true ? action : this.prefix;
102108
$.each(this, function (key, value) {
103109
if ($.type(value) === 'string' &&
104110
value.charAt(0) === '@') {
105-
settings[key] = options[value.slice(1)];
111+
settings[key] = options[
112+
value.slice(1) || (prefix ? prefix +
113+
key.charAt(0).toUpperCase() + key.slice(1) : key)
114+
];
106115
} else {
107116
settings[key] = value;
108117
}
118+
109119
});
110120
processQueue.push(settings);
111121
});
@@ -127,10 +137,14 @@
127137
if (this._processing === 0) {
128138
this._trigger('processstart');
129139
}
130-
$.each(data.files, function (index, file) {
140+
$.each(data.files, function (index) {
131141
var opts = index ? $.extend({}, options) : options,
132142
func = function () {
133-
return that._processFile(opts);
143+
if (data.errorThrown) {
144+
return $.Deferred()
145+
.rejectWith(that, [data]).promise();
146+
}
147+
return that._processFile(opts, data);
134148
};
135149
opts.index = index;
136150
that._processing += 1;

0 commit comments

Comments
 (0)