Explorar o código

Fix #1099: Enhance mime type parsing for IE 11

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

+ 2 - 1
CHANGE.md

@@ -3,8 +3,9 @@ Change Log: `bootstrap-fileinput`
 
 ## version 4.4.6 (_under development_)
 
-**Date:** 03-Oct-2017
+**Date:** 04-Oct-2017
 
+- (enh #1099): Enhance mime type parsing for IE 11. 
 - (enh #1097): Add support for previewing Office file formats (e.g. docx, xlsx, pptx). 
     - Supports all common formats that google docs can view.
     - Available only for initial preview content (where the document is accessible via a public web link).

+ 5 - 5
js/fileinput.js

@@ -2977,7 +2977,7 @@
                         self._errorHandler(evt, caption);
                     };
                     reader.onload = function (theFile) {
-                        var uint, hex, fileInfo, bytes = [], contents, mime, readTextImage = function (textFlag) {
+                        var hex, fileInfo, uint, byte, bytes = [], contents, mime, readTextImage = function (textFlag) {
                             var newReader = new FileReader();
                             newReader.onerror = function (theFileNew) {
                                 self._errorHandler(theFileNew, caption);
@@ -3001,12 +3001,12 @@
                         });
                         if (knownTypes === 0) {// auto detect mime types from content if no known file types detected
                             uint = new Uint8Array(theFile.target.result);
-                            uint.forEach(function (byte) {
-                                bytes.push(byte.toString(16));
-                            });
+                            for (j = 0; j < uint.length; j++) {
+                                byte = uint[j].toString(16);
+                                bytes.push(byte);
+                            }
                             hex = bytes.join('').toLowerCase().substring(0, 8);
                             mime = $h.getMimeType(hex, '', '');
-
                             if ($h.isEmpty(mime)) { // look for ascii text content
                                 contents = $h.arrayBuffer2String(reader.result);
                                 mime = $h.isSvg(contents) ? 'image/svg+xml' : $h.getMimeType(hex, contents, file.type);

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