Browse Source

Set meta on file compression (#3644)

The meta field was not updated when a new file was generated
Camilo Forero 3 năm trước cách đây
mục cha
commit
c69fa01c92
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      packages/@uppy/compressor/src/index.js

+ 4 - 3
packages/@uppy/compressor/src/index.js

@@ -50,15 +50,16 @@ export default class Compressor extends BasePlugin {
           const compressedSavingsSize = file.data.size - compressedBlob.size
           this.uppy.log(`[Image Compressor] Image ${file.id} compressed by ${prettierBytes(compressedSavingsSize)}`)
           totalCompressedSize += compressedSavingsSize
-          const { name } = compressedBlob
+          const { name, type, size } = compressedBlob
           const { extension } = getFileNameAndExtension(name)
           this.uppy.setFileState(file.id, {
             name,
             extension,
-            type: compressedBlob.type,
+            type,
+            size,
             data: compressedBlob,
-            size: compressedBlob.size,
           })
+          this.uppy.setFileMeta(file.id, { name, type })
         } catch (err) {
           this.uppy.log(`[Image Compressor] Failed to compress ${file.id}:`, 'warning')
           this.uppy.log(err, 'warning')