Browse Source

[IMP] web_drop_target: Make sure is a Blob object

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.

Taken from #1209

Co-Authored-By: George Daramouskas <daramousk@users.noreply.github.com>
pull/1313/head
Pablo Fuentes 5 years ago
committed by Enric Tobella
parent
commit
c04d3790d3
  1. 3
      web_drop_target/static/src/js/web_drop_target.js

3
web_drop_target/static/src/js/web_drop_target.js

@ -110,6 +110,9 @@ odoo.define('web_drop_target', function(require) {
) {
var self = this;
var file = item;
if(!file || !(file instanceof Blob)) {
return;
}
var reader = new FileReader();
reader.onloadend = self.proxy(
_.partial(self._create_attachment, file, reader, e, res_model, res_id, extra_data)

Loading…
Cancel
Save