From d558b9e3e8669a42d92722eb209609a1af4e0bdd Mon Sep 17 00:00:00 2001 From: yflory <yann.flory@xwiki.com> Date: Tue, 12 Jun 2018 15:21:57 +0200 Subject: [PATCH] Fix 404 issues in media-tag --- www/common/media-tag.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/www/common/media-tag.js b/www/common/media-tag.js index b84629ec8..5b911f2b8 100644 --- a/www/common/media-tag.js +++ b/www/common/media-tag.js @@ -96,11 +96,17 @@ // Download a blob from href - var download = function (src, cb) { + var download = function (src, _cb) { + var cb = function (e, res) { + _cb(e, res); + cb = function () {}; + }; + var xhr = new XMLHttpRequest(); xhr.open('GET', src, true); xhr.responseType = 'arraybuffer'; + xhr.onerror = function () { return void cb("XHR_ERROR"); }; xhr.onload = function () { // Error? if (/^4/.test('' + this.status)) { return void cb("XHR_ERROR " + this.status); }