Skip to content

Commit 5b227f1

Browse files
Danial FaridDanial Farid
authored andcommitted
1 parent 05be0d9 commit 5b227f1

17 files changed

+56
-71
lines changed

demo/src/main/webapp/js/FileAPI.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload-all.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**!
22
* AngularJS file upload/drop directive and service with progress and abort
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 5.0.6
4+
* @version 5.0.7
55
*/
66
var ngFileUpload = angular.module('ngFileUpload', []);
77

8-
ngFileUpload.version = '5.0.6';
8+
ngFileUpload.version = '5.0.7';
99
ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
1010
function patchXHR(fnName, newFn) {
1111
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
@@ -412,11 +412,11 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
412412
files, rejFiles, evt, noDelay) {
413413
function update() {
414414
if ($parse(attr.ngfKeep)(scope) === true) {
415+
var prevFiles = (ngModel.$modelValue || []).slice(0);
415416
if (!files || !files.length) {
416-
return;
417-
}
418-
if ($parse(attr.ngfKeepDistinct)(scope) === true) {
419-
var prevFiles = (ngModel.$modelValue || []).slice(0), len = prevFiles.length;
417+
files = prevFiles;
418+
} else if ($parse(attr.ngfKeepDistinct)(scope) === true) {
419+
var len = prevFiles.length;
420420
for (var i = 0; i < files.length; i++) {
421421
for (var j = 0; j < len; j++) {
422422
if (files[i].name === prevFiles[j].name) break;
@@ -425,12 +425,9 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
425425
prevFiles.push(files[i]);
426426
}
427427
}
428-
if (len === prevFiles.length) {
429-
return;
430-
}
431-
files = [].concat(prevFiles);
428+
files = prevFiles;
432429
} else {
433-
files = (ngModel.$modelValue || []).concat(files);
430+
files = prevFiles.concat(files);
434431
}
435432
}
436433
if (ngModel) {
@@ -739,7 +736,7 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
739736
* AngularJS file upload/drop directive and service with progress and abort
740737
* FileAPI Flash shim for old browsers not supporting FormData
741738
* @author Danial <danial.farid@gmail.com>
742-
* @version 5.0.6
739+
* @version 5.0.7
743740
*/
744741

745742
(function () {

demo/src/main/webapp/js/ng-file-upload-all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* AngularJS file upload/drop directive and service with progress and abort
33
* FileAPI Flash shim for old browsers not supporting FormData
44
* @author Danial <danial.farid@gmail.com>
5-
* @version 5.0.6
5+
* @version 5.0.7
66
*/
77

88
(function () {

demo/src/main/webapp/js/ng-file-upload-shim.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**!
22
* AngularJS file upload/drop directive and service with progress and abort
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 5.0.6
4+
* @version 5.0.7
55
*/
66
var ngFileUpload = angular.module('ngFileUpload', []);
77

8-
ngFileUpload.version = '5.0.6';
8+
ngFileUpload.version = '5.0.7';
99
ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
1010
function patchXHR(fnName, newFn) {
1111
window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
@@ -412,11 +412,11 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
412412
files, rejFiles, evt, noDelay) {
413413
function update() {
414414
if ($parse(attr.ngfKeep)(scope) === true) {
415+
var prevFiles = (ngModel.$modelValue || []).slice(0);
415416
if (!files || !files.length) {
416-
return;
417-
}
418-
if ($parse(attr.ngfKeepDistinct)(scope) === true) {
419-
var prevFiles = (ngModel.$modelValue || []).slice(0), len = prevFiles.length;
417+
files = prevFiles;
418+
} else if ($parse(attr.ngfKeepDistinct)(scope) === true) {
419+
var len = prevFiles.length;
420420
for (var i = 0; i < files.length; i++) {
421421
for (var j = 0; j < len; j++) {
422422
if (files[i].name === prevFiles[j].name) break;
@@ -425,12 +425,9 @@ ngFileUpload.service('Upload', ['$http', '$q', '$timeout', function ($http, $q,
425425
prevFiles.push(files[i]);
426426
}
427427
}
428-
if (len === prevFiles.length) {
429-
return;
430-
}
431-
files = [].concat(prevFiles);
428+
files = prevFiles;
432429
} else {
433-
files = (ngModel.$modelValue || []).concat(files);
430+
files = prevFiles.concat(files);
434431
}
435432
}
436433
if (ngModel) {

0 commit comments

Comments
 (0)