Forráskód Böngészése

if blob is empty on paste, log errors and return, skip `addFile`

Artur Paikin 7 éve
szülő
commit
c404e1b434
1 módosított fájl, 6 hozzáadás és 1 törlés
  1. 6 1
      src/plugins/Dashboard/Dashboard.js

+ 6 - 1
src/plugins/Dashboard/Dashboard.js

@@ -33,7 +33,12 @@ module.exports = function Dashboard (props) {
       if (file.kind !== 'file') return
       if (file.kind !== 'file') return
 
 
       const blob = file.getAsFile()
       const blob = file.getAsFile()
-      props.log('File pasted')
+      if (!blob) {
+        props.log('[Dashboard] File pasted, but the file blob is empty')
+        props.info('Error pasting file', 'error')
+        return
+      }
+      props.log('[Dashboard] File pasted')
       props.addFile({
       props.addFile({
         source: props.id,
         source: props.id,
         name: file.name,
         name: file.name,