浏览代码

bufferToUrl filter: Handle image/jpg mime type

This MIME type is not valid (correct would be `image/jpeg`),
but can still occur "in the wild".
Danilo Bargen 7 年之前
父节点
当前提交
6888371cd9
共有 2 个文件被更改,包括 2 次插入1 次删除
  1. 1 1
      src/directives/avatar_editor.ts
  2. 1 0
      src/filters.ts

+ 1 - 1
src/directives/avatar_editor.ts

@@ -126,7 +126,7 @@ export default [
                     }
                     // get first
                     fetchFileContent(fileList[0]).then((data: ArrayBuffer) => {
-                        const image = $filter('bufferToUrl')(data, 'image/jpg', false);
+                        const image = $filter('bufferToUrl')(data, 'image/jpeg', false);
                         setImage(image);
                     }).catch((ev: ErrorEvent) => {
                         $log.error(logTag, 'Could not load file:', ev.message);

+ 1 - 0
src/filters.ts

@@ -259,6 +259,7 @@ angular.module('3ema.filters', [])
             binary += String.fromCharCode(bytes[i]);
         }
         switch (mimeType) {
+            case 'image/jpg':
             case 'image/jpeg':
             case 'image/png':
             case 'image/webp':