Browse Source

Merge pull request #1092 from transloadit/image-jpg

thumbnail-generator: Fix JPG previews on Edge
Renée Kooi 6 năm trước cách đây
mục cha
commit
e768bbfdde

+ 1 - 1
packages/@uppy/utils/src/isPreviewSupported.js

@@ -2,7 +2,7 @@ module.exports = function isPreviewSupported (fileType) {
   if (!fileType) return false
   const fileTypeSpecific = fileType.split('/')[1]
   // list of images that browsers can preview
-  if (/^(jpeg|gif|png|svg|svg\+xml|bmp)$/.test(fileTypeSpecific)) {
+  if (/^(jpe?g|gif|png|svg|svg\+xml|bmp)$/.test(fileTypeSpecific)) {
     return true
   }
   return false

+ 1 - 1
packages/@uppy/utils/src/isPreviewSupported.test.js

@@ -2,7 +2,7 @@ const isPreviewSupported = require('./isPreviewSupported')
 
 describe('isPreviewSupported', () => {
   it('should return true for any filetypes that browsers can preview', () => {
-    const supported = ['image/jpeg', 'image/gif', 'image/png', 'image/svg', 'image/svg+xml', 'image/bmp']
+    const supported = ['image/jpeg', 'image/gif', 'image/png', 'image/svg', 'image/svg+xml', 'image/bmp', 'image/jpg']
     supported.forEach(ext => {
       expect(isPreviewSupported(ext)).toEqual(true)
     })

+ 0 - 5
test/endtoend/thumbnails/test.js

@@ -21,11 +21,6 @@ describe('ThumbnailGenerator', () => {
   })
 
   it('should generate thumbnails for images', function () {
-    // FIXME why isn't the selectFakeFile alternative below working?
-    if (!supportsChooseFile()) {
-      return this.skip()
-    }
-
     $('#uppyThumbnails .uppy-FileInput-input').waitForExist()
 
     browser.execute(/* must be valid ES5 for IE */ function () {