3
0
Fork 0

[FIX] web_drop_target Make sure that when a File is dropped into a form the event is propagated and the action only takes place when the element dropped is actually a Blob object

12.0
George Daramouskas 2019-03-08 11:02:38 +01:00
parent 2d63d4dedf
commit 6304a2baaa
No known key found for this signature in database
GPG Key ID: 5B4EF742F8CD859C
1 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,7 @@ odoo.define('web_drop_target', function(require) {
_on_drop: function(e) {
var drop_item = this._get_drop_item(e);
if(!drop_item) {
if(!drop_item || !(drop_item.getAsFile() instanceof Blob)) {
return;
}
jQuery(e.delegateTarget).removeClass(this._drag_over_class);
@ -35,6 +35,7 @@ odoo.define('web_drop_target', function(require) {
_.partial(this._handle_file_drop, drop_item.getAsFile())
);
reader.readAsArrayBuffer(drop_item.getAsFile());
e.stopPropagation();
e.preventDefault();
},