PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
← All changes | assets/js/charitable-plupload-fields.js +17 -2 1.7.0 → 1.8.13 View file →
@@ -131,15 +131,22 @@
131 131 /**
132 132 * FileUploaded event
133 133 */
134 134 Uploader.prototype.FileUploaded = function( uploader, file, r ) {
135 - var input, data;
135 + var input, data, message;
136 136
137 137 r = $.parseJSON( r.response );
138 138
139 139 if ( ! r.success ) {
140 140
141 - this.add_image_error( file, CHARITABLE_UPLOAD_VARS.upload_problem.replace('%s', file.name) );
141 + // Show the server's own reason when it sends one - a refusal ("please log in")
142 + // or a rejected file type is not something retrying can fix, so the generic
143 + // "please try again" is only the fallback. Only data.message is trusted here:
144 + // data.error carries WordPress core's raw upload errors, which name php.ini
145 + // directives and server paths and must not be shown to public visitors.
146 + message = r.data && typeof r.data.message === 'string' ? r.data.message : '';
147 +
148 + this.add_image_error( file, message || CHARITABLE_UPLOAD_VARS.upload_problem.replace('%s', file.name) );
142 149 return;
143 150
144 151 }
145 152
@@ -240,8 +247,16 @@
240 247 * @return void
241 248 */
242 249 Uploader.prototype.add_image_error = function( file, msg ) {
243 250 var self = this;
251 +
252 + // FileFiltered counted this file against max_file_uploads before it was sent. A
253 + // failed upload never becomes a preview, so nothing else gives the slot back, and
254 + // without this the next attempt is rejected client-side with the "you have already
255 + // uploaded the maximum number of files" alert and the user is stuck until reload.
256 + if ( self.uploaded > 0 ) {
257 + self.uploaded -= 1;
258 + }
244 259
245 260 self.$dropzone.fadeIn( 300 );
246 261
247 262 self.$loader.find( '[data-file-id=' + file.id + ']' ).addClass( 'error' ).text( msg ).delay( 5000 ).fadeOut( 300, function(){