From eceb8b678c2c482d63de486eaa3fc799de153787 Mon Sep 17 00:00:00 2001
From: Eugen Neuber <eugen.neuber@tugraz.at>
Date: Wed, 20 May 2020 10:50:19 +0200
Subject: [PATCH] Deny files with size 0 bytes

See issue #1
---
 packages/file-handling/src/fileupload.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/packages/file-handling/src/fileupload.js b/packages/file-handling/src/fileupload.js
index 53e9da62..88e825aa 100644
--- a/packages/file-handling/src/fileupload.js
+++ b/packages/file-handling/src/fileupload.js
@@ -149,6 +149,10 @@ export class FileUpload extends ScopedElementsMixin(VPULitElement) {
         // we need to copy the files to another array or else they will be gone in the setTimeout function!
         let tempFilesToHandle = [];
         await commonUtils.asyncArrayForEach(files, async (file) => {
+            if (file.size === 0) {
+                console.log('file ' + file.name + ' has size=0 and is denied!')
+                return;
+            }
             tempFilesToHandle.push(file);
         });
 
-- 
GitLab