From: Johannes Zellner Date: Fri, 18 May 2018 19:12:50 +0000 (+0200) Subject: Do not error if a user tries to upload a file without a type X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git;a=commitdiff_plain;h=3df9f8a6fc959eaa0924722ad9ce0675d80369f9 Do not error if a user tries to upload a file without a type --- diff --git a/frontend/js/app.js b/frontend/js/app.js index b68b608..dce3a60 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -136,6 +136,9 @@ function uploadFiles(files) { app.uploadStatus.percentDone = 0; asyncForEach(files, function (file, callback) { + // do not handle directories (file.type is empty in such a case) + if (file.type === '') return callback(); + var path = encode(sanitize(app.path + '/' + (file.webkitRelativePath || file.name))); var formData = new FormData();