From 3fac7b5bb7e490c9cd641f0ddd6de2d2c76915f6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 23 Sep 2019 09:02:53 +0000 Subject: composer update blueimp/jquery-file-upload (cherry picked from commit 53b8ee7866eb1394980b08b90153a63563832391) --- vendor/blueimp/jquery-file-upload/README.md | 8 +++-- vendor/blueimp/jquery-file-upload/basic-plus.html | 14 ++++----- vendor/blueimp/jquery-file-upload/bower.json | 2 +- .../jquery-file-upload/js/jquery.fileupload.js | 35 +++++++++++++++++++++- vendor/blueimp/jquery-file-upload/package.json | 2 +- 5 files changed, 49 insertions(+), 12 deletions(-) (limited to 'vendor/blueimp') diff --git a/vendor/blueimp/jquery-file-upload/README.md b/vendor/blueimp/jquery-file-upload/README.md index d9e16ed18..ef839d6c7 100644 --- a/vendor/blueimp/jquery-file-upload/README.md +++ b/vendor/blueimp/jquery-file-upload/README.md @@ -96,12 +96,16 @@ The File Upload plugin is regularly tested with the latest browser versions and ### Mobile browsers The File Upload plugin has been tested with and supports the following mobile browsers: -* Apple Safari on iOS 6.0+ -* Google Chrome on iOS 6.0+ +* Apple Safari on iOS 6.0+ (see Caveats below) +* Google Chrome on iOS 6.0+ (see Caveats below) * Google Chrome on Android 4.0+ * Default Browser on Android 2.3+ * Opera Mobile 12.0+ +### Caveats + +- iOS 9 has a [known bug](https://apple.stackexchange.com/questions/118154) where photos chosen from the Photo Library are all given the name `image.jpeg`, which is problematic when uploading multiple files at a time. Ideally your server should be responsible for deduplicating file uploads ([example](https://github.com/blueimp/jQuery-File-Upload/blob/master/server/php/UploadHandler.php#L490)). If you don't have control, as in the case of direct uploads to S3, you can pass an option `uniqueFilenames: {}` as part of the options object, which tells the uploader to deduplicate filenames. More details [here](https://github.com/blueimp/jQuery-File-Upload/commit/d419f43478aeafe95a794815f80a3016f58eb3b7). + ### Supported features For a detailed overview of the features supported by each browser version, please have a look at the [Extended browser support information](https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support). diff --git a/vendor/blueimp/jquery-file-upload/basic-plus.html b/vendor/blueimp/jquery-file-upload/basic-plus.html index 6d53acdc1..59019a3eb 100644 --- a/vendor/blueimp/jquery-file-upload/basic-plus.html +++ b/vendor/blueimp/jquery-file-upload/basic-plus.html @@ -162,14 +162,14 @@ $(function () { }).on('fileuploadadd', function (e, data) { data.context = $('
').appendTo('#files'); $.each(data.files, function (index, file) { - var node = $('

') - .append($('').text(file.name)); - if (!index) { - node - .append('
') - .append(uploadButton.clone(true).data(data)); + $('

') + .append($('').text(file.name)) + .appendTo(data.context); + if (index === data.files.length - 1) { + $('

') + .append(uploadButton.clone(true).data(data)) + .appendTo(data.context); } - node.appendTo(data.context); }); }).on('fileuploadprocessalways', function (e, data) { var index = data.index, diff --git a/vendor/blueimp/jquery-file-upload/bower.json b/vendor/blueimp/jquery-file-upload/bower.json index 3a771f9ee..b57c0aa22 100644 --- a/vendor/blueimp/jquery-file-upload/bower.json +++ b/vendor/blueimp/jquery-file-upload/bower.json @@ -1,6 +1,6 @@ { "name": "blueimp-file-upload", - "version": "9.31.0", + "version": "9.34.0", "title": "jQuery File Upload", "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images.", "keywords": [ diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js index 700f9013c..53c169e2a 100644 --- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js @@ -165,6 +165,15 @@ bitrateInterval: 500, // By default, uploads are started automatically when adding files: autoUpload: true, + // By default, duplicate file names are expected to be handled on + // the server-side. If this is not possible (e.g. when uploading + // files directly to Amazon S3), the following option can be set to + // an empty object or an object mapping existing filenames, e.g.: + // { "image.jpg": true, "image (1).jpg": true } + // If it is set, all files will be uploaded with unique filenames, + // adding increasing number suffixes if necessary, e.g.: + // "image (2).jpg" + uniqueFilenames: undefined, // Error and info messages: messages: { @@ -449,6 +458,23 @@ return Object.prototype.toString.call(obj) === '[object ' + type + ']'; }, + _getUniqueFilename: function (name, map) { + name = String(name); + if (map[name]) { + name = name.replace( + /(?: \(([\d]+)\))?(\.[^.]+)?$/, + function (_, p1, p2) { + var index = p1 ? Number(p1) + 1 : 1; + var ext = p2 || ''; + return ' (' + index + ')' + ext; + } + ); + return this._getUniqueFilename(name, map); + } + map[name] = true; + return name; + }, + _initXHRData: function (options) { var that = this, formData, @@ -510,11 +536,18 @@ // dummy objects: if (that._isInstanceOf('File', file) || that._isInstanceOf('Blob', file)) { + var fileName = file.uploadName || file.name; + if (options.uniqueFilenames) { + fileName = that._getUniqueFilename( + fileName, + options.uniqueFilenames + ); + } formData.append( ($.type(options.paramName) === 'array' && options.paramName[index]) || paramName, file, - file.uploadName || file.name + fileName ); } }); diff --git a/vendor/blueimp/jquery-file-upload/package.json b/vendor/blueimp/jquery-file-upload/package.json index bb1f9fbc5..b884aa126 100644 --- a/vendor/blueimp/jquery-file-upload/package.json +++ b/vendor/blueimp/jquery-file-upload/package.json @@ -1,6 +1,6 @@ { "name": "blueimp-file-upload", - "version": "9.31.0", + "version": "9.34.0", "title": "jQuery File Upload", "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.", "keywords": [ -- cgit v1.2.3