Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/thumbnail-generator

Package Overview
Dependencies
Maintainers
5
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/thumbnail-generator - npm Package Compare versions

Comparing version 1.7.8 to 1.7.9

17

lib/index.js

@@ -38,3 +38,3 @@ var _class, _temp;

_this.onFileAdded = function (file) {
if (!file.preview && isPreviewSupported(file.type) && !file.isRemote) {
if (!file.preview && file.data && isPreviewSupported(file.type) && !file.isRemote) {
_this.addToQueue(file.id);

@@ -66,11 +66,8 @@ }

_this.onRestored = function () {
var _this$uppy$getState = _this.uppy.getState(),
files = _this$uppy$getState.files;
var restoredFiles = _this.uppy.getFiles().filter(function (file) {
return file.isRestored;
});
var fileIDs = Object.keys(files);
fileIDs.forEach(function (fileID) {
var file = _this.uppy.getFile(fileID);
if (!file.isRestored) return; // Only add blob URLs; they are likely invalid after being restored.
restoredFiles.forEach(function (file) {
// Only add blob URLs; they are likely invalid after being restored.
if (!file.preview || isObjectURL(file.preview)) {

@@ -471,2 +468,2 @@ _this.addToQueue(file.id);

return ThumbnailGenerator;
}(Plugin), _class.VERSION = "1.7.8", _temp);
}(Plugin), _class.VERSION = "1.7.9", _temp);
{
"name": "@uppy/thumbnail-generator",
"description": "Uppy plugin that generates small previews of images to show on your upload UI.",
"version": "1.7.8",
"version": "1.7.9",
"license": "MIT",

@@ -25,3 +25,3 @@ "main": "lib/index.js",

"dependencies": {
"@uppy/utils": "^3.5.0",
"@uppy/utils": "^3.6.0",
"exifr": "^6.0.0",

@@ -36,3 +36,3 @@ "math-log2": "^1.0.1"

},
"gitHead": "6771545fe70134088a5441ef5c2f7b872e32d812"
"gitHead": "12b7bd34e8f193e86561dd623024279103865a85"
}

@@ -311,3 +311,8 @@ const { Plugin } = require('@uppy/core')

onFileAdded = (file) => {
if (!file.preview && isPreviewSupported(file.type) && !file.isRemote) {
if (
!file.preview
&& file.data
&& isPreviewSupported(file.type)
&& !file.isRemote
) {
this.addToQueue(file.id)

@@ -343,7 +348,4 @@ }

onRestored = () => {
const { files } = this.uppy.getState()
const fileIDs = Object.keys(files)
fileIDs.forEach((fileID) => {
const file = this.uppy.getFile(fileID)
if (!file.isRestored) return
const restoredFiles = this.uppy.getFiles().filter(file => file.isRestored)
restoredFiles.forEach((file) => {
// Only add blob URLs; they are likely invalid after being restored.

@@ -350,0 +352,0 @@ if (!file.preview || isObjectURL(file.preview)) {

@@ -104,5 +104,5 @@ const ThumbnailGeneratorPlugin = require('./index')

const file1 = { id: 'bar', type: 'image/jpeg' }
const file2 = { id: 'bar2', type: 'image/jpeg' }
const file3 = { id: 'bar3', type: 'image/jpeg' }
const file1 = { id: 'bar', type: 'image/jpeg', data: new Blob() }
const file2 = { id: 'bar2', type: 'image/jpeg', data: new Blob() }
const file3 = { id: 'bar3', type: 'image/jpeg', data: new Blob() }
core.mockFile(file1.id, file1)

@@ -152,4 +152,4 @@ core.emit('file-added', file1)

const file1 = { id: 1, name: 'bar.jpg', type: 'image/jpeg' }
const file2 = { id: 2, name: 'bar2.jpg', type: 'image/jpeg' }
const file1 = { id: 1, name: 'bar.jpg', type: 'image/jpeg', data: new Blob() }
const file2 = { id: 2, name: 'bar2.jpg', type: 'image/jpeg', data: new Blob() }
core.mockFile(file1.id, file1)

@@ -200,5 +200,5 @@ core.emit('file-added', file1)

})
add({ id: 'bar', type: 'image/png' })
add({ id: 'bar2', type: 'image/png' })
add({ id: 'bar3', type: 'image/png' })
add({ id: 'bar', type: 'image/png', data: new Blob() })
add({ id: 'bar2', type: 'image/png', data: new Blob() })
add({ id: 'bar3', type: 'image/png', data: new Blob() })
}))

@@ -209,4 +209,4 @@

core.on('thumbnail:all-generated', resolve)
add({ id: 'bar4', type: 'image/png' })
add({ id: 'bar5', type: 'image/png' })
add({ id: 'bar4', type: 'image/png', data: new Blob() })
add({ id: 'bar5', type: 'image/png', data: new Blob() })
}).then(() => {

@@ -491,5 +491,5 @@ expect(plugin.queue).toHaveLength(0)

const files = {
a: { id: 'a', type: 'image/jpeg', preview: 'blob:abc', isRestored: true },
b: { id: 'b', type: 'image/jpeg', preview: 'blob:def' },
c: { id: 'c', type: 'image/jpeg', preview: 'blob:xyz', isRestored: true },
a: { id: 'a', type: 'image/jpeg', isRestored: true, data: new Blob() },
b: { id: 'b', type: 'image/jpeg', data: new Blob() },
c: { id: 'c', type: 'image/jpeg', isRestored: true, data: new Blob() },
}

@@ -503,2 +503,5 @@ const core = Object.assign(new MockCore(), {

},
getFiles () {
return Object.values(files)
},
})

@@ -528,2 +531,5 @@

},
getFiles () {
return Object.values(files)
},
})

@@ -530,0 +536,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc