guard against a type error when downloading the content of a media-tag

pull/1/head
ansuz 5 years ago
parent b4f33f6056
commit d3e417a984

@ -399,14 +399,16 @@ define([
e.stopPropagation();
m.hide();
var $mt = $menu.data('mediatag');
if ($(this).hasClass("cp-app-code-context-saveindrive")) {
var $this = $(this);
if ($this.hasClass("cp-app-code-context-saveindrive")) {
common.importMediaTag($mt);
}
else if ($(this).hasClass("cp-app-code-context-download")) {
var media = $mt[0]._mediaObject;
else if ($this.hasClass("cp-app-code-context-download")) {
var media = Util.find($mt, [0, '_mediaObject']);
if (!(media && media._blob)) { return void console.error($mt); }
window.saveAs(media._blob.content, media.name);
}
else if ($(this).hasClass("cp-app-code-context-open")) {
else if ($this.hasClass("cp-app-code-context-open")) {
$mt.trigger('preview');
}
});

Loading…
Cancel
Save