From c3f18feaaecfef2199955830fb9942642e20e6b3 Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:15:21 +0100 Subject: [PATCH] Fix/82 import (#83) * fix/82-import fix import extension filter * fix/82-import version bump --- client/src/features/menu/MenuBar.jsx | 20 +++++++++++--------- server/package.json | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/client/src/features/menu/MenuBar.jsx b/client/src/features/menu/MenuBar.jsx index 9027773fbf..e32d4f7cb0 100644 --- a/client/src/features/menu/MenuBar.jsx +++ b/client/src/features/menu/MenuBar.jsx @@ -40,6 +40,7 @@ export default function MenuBar(props) { const handleUpload = (event) => { const fileUploaded = event.target.files[0]; + console.log('1', fileUploaded) if (fileUploaded == null) return; // Limit file size to 1MB @@ -48,17 +49,18 @@ export default function MenuBar(props) { return; } + console.log('2', ! fileUploaded.name.endsWith('.xlsx') + || !fileUploaded.name.endsWith('.json')) + // Check file extension - if (! fileUploaded.name.endsWith('.xlsx') - || !fileUploaded.name.endsWith('.json')) { + if (fileUploaded.name.endsWith('.xlsx') || fileUploaded.name.endsWith('.json')) { + try { + uploaddb.mutate(fileUploaded); + } catch (error) { + emitError(`Failed uploading file: ${error}`) + } + } else { emitError('Error: File type unknown') - return; - } - - try { - uploaddb.mutate(fileUploaded); - } catch (error) { - emitError(`Failed uploading file: ${error}`) } // reset input value diff --git a/server/package.json b/server/package.json index dc52975420..9206ebbf45 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "ontime", - "version": "0.5.0", + "version": "0.5.1", "author": "Carlos Valente", "description": "Time keeping for live events", "repository": "https://github.com/cpvalente/ontime",