From 74d8a12c0726c0082480548914e48e78803662df Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Mon, 19 Nov 2018 10:48:52 -0800 Subject: [PATCH] fixes #1013. dragging page elements --- app/controller.js | 3 +++ app/dragManager.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controller.js b/app/controller.js index b43a91ca..897679e0 100644 --- a/app/controller.js +++ b/app/controller.js @@ -98,6 +98,9 @@ export default function(state, emitter) { }); emitter.on('addFiles', async ({ files }) => { + if (files.length < 1) { + return; + } const maxSize = state.user.maxSize; state.archive = state.archive || new Archive(); try { diff --git a/app/dragManager.js b/app/dragManager.js index f5133a0a..1379c004 100644 --- a/app/dragManager.js +++ b/app/dragManager.js @@ -6,7 +6,12 @@ export default function(state, emitter) { } }); document.body.addEventListener('drop', event => { - if (state.route === '/' && !state.uploading) { + if ( + state.route === '/' && + !state.uploading && + event.dataTransfer && + event.dataTransfer.files + ) { event.preventDefault(); emitter.emit('addFiles', { files: Array.from(event.dataTransfer.files)