WordPress.org

Make WordPress Core

Ticket #19001: 19001.1.patch

File 19001.1.patch, 1.0 KB (added by kurtpayne, 7 years ago)

Show error message, don't create duplicate file entries in the queue

  • wp-includes/js/plupload/handlers.dev.js

     
    66
    77// progress and success handlers for media multi uploads
    88function fileQueued(fileObj) {
     9        if ( fileIsQueued(fileObj) )
     10                return true;
    911        // Get rid of unused form
    1012        jQuery('.media-blank').remove();
    1113        // Collapse a single item
     
    2426        jQuery('#cancel-upload').prop('disabled', false);
    2527}
    2628
     29// see if the file is in the queue
     30function fileIsQueued(fileObj) {
     31        return 1 == jQuery('#media-item-' + fileObj.id ,jQuery('#media-items')).length;
     32}
     33
    2734function uploadStart(fileObj) {
    2835        try {
    2936                if ( typeof topWin.tb_remove != 'undefined' )
     
    435442                });
    436443
    437444                uploader.bind('Error', function(up, err) {
     445                        if ( !fileIsQueued(err.file) )
     446                                fileQueued(err.file);
    438447                        uploadError(err.file, err.code, err.message);
    439448
    440449                        up.refresh();