Explorar o código

Fix #398: Validate `data.errorkeys` more correctly

Kartik Visweswaran %!s(int64=9) %!d(string=hai) anos
pai
achega
aa2494bced
Modificáronse 3 ficheiros con 4 adicións e 3 borrados
  1. 1 0
      CHANGE.md
  2. 3 3
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -19,6 +19,7 @@ Change Log: `bootstrap-fileinput`
 12. (enh #390): Thumbnail error display enhancements.
 13. (enh #391): Thumbnail styling enhancements for flash, html, and object types.
 14. (enh #393): Minor enhancements to abort events before upload.
+15. (bug #398): Validate `data.errorkeys` more correctly.
 
 ## version 4.2.5
 

+ 3 - 3
js/fileinput.js

@@ -415,7 +415,7 @@
             }
         },
         isEmpty = function (value, trim) {
-            return value === null || value === undefined || value.length === 0 || (trim && $.trim(value) === '');
+            return value === undefined || value === null || value.length === 0 || (trim && $.trim(value) === '');
         },
         isArray = function (a) {
             return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]';
@@ -1509,8 +1509,8 @@
                 }
             };
             fnSuccess = function (data, textStatus, jqXHR) {
-                var outData = self.getOutData(jqXHR, data), $thumbs = self.getThumbs(),
-                    keys = isEmpty(data.errorkeys) ? [] : data.errorkeys, key = 0;
+                var outData = self.getOutData(jqXHR, data), $thumbs = self.getThumbs(), key = 0;
+                    keys = isEmpty(data) || isEmpty(data.errorkeys) ? [] : data.errorkeys;
                 if (isEmpty(data) || isEmpty(data.error)) {
                     self.raise('filebatchuploadsuccess', [outData]);
                     setAllUploaded();

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
js/fileinput.min.js


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio