From 42f2142e368821eb14d6810ebab27cf4d0eeb0f7 Mon Sep 17 00:00:00 2001 From: Lilia Date: Fri, 22 Sep 2017 18:44:09 +0200 Subject: [PATCH] Fix RangeError on non-file drag/drop events (#1498) ConversationView responds to drag/drop events by forwarding them to its file input. The file input stops propagation and handles the event only if the data transfer is type file. This means that any other data type (text, img, etc...) causes an recursive loop of event propagation, eventually resulting in logging a "RangeError: Maximum call stack size exceeded". Fix by only forwarding files to the file input. // FREEBIE --- js/views/conversation_view.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 02d0d8f8d..93d7aeae9 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -208,6 +208,9 @@ 'dragleave': 'sendToFileInput' }, sendToFileInput: function(e) { + if (e.originalEvent.dataTransfer.types[0] != 'Files') { + return; + } this.fileInput.$el.trigger(e); },