Fix upload error with audio files

pull/1/head
yflory 5 years ago
parent 9e947e4fd6
commit 565a855734

@ -110,8 +110,11 @@ define([
c2.height = D.dim; c2.height = D.dim;
var ctx = c2.getContext('2d'); var ctx = c2.getContext('2d');
try {
ctx.drawImage(canvas, D.x, D.y, D.w, D.h); ctx.drawImage(canvas, D.x, D.y, D.w, D.h);
} catch (e) {
return void cb('ERROR');
}
cb(void 0, c2.toDataURL()); cb(void 0, c2.toDataURL());
}; };
@ -157,6 +160,8 @@ define([
viewport: page.getViewport(scale) viewport: page.getViewport(scale)
}).promise.then(function () { }).promise.then(function () {
return canvas; return canvas;
}).catch(function () {
cb('ERROR');
}); });
}; };
PDFJS.getDocument(url).promise PDFJS.getDocument(url).promise
@ -190,7 +195,8 @@ define([
}); });
reader.readAsText(blob); reader.readAsText(blob);
}; };
Thumb.fromBlob = function (blob, cb) { Thumb.fromBlob = function (blob, _cb) {
var cb = Util.once(_cb);
if (blob.type.indexOf('video/') !== -1) { if (blob.type.indexOf('video/') !== -1) {
return void Thumb.fromVideoBlob(blob, cb); return void Thumb.fromVideoBlob(blob, cb);
} }
@ -200,7 +206,10 @@ define([
if (Util.isPlainTextFile(blob.type, blob.name)) { if (Util.isPlainTextFile(blob.type, blob.name)) {
return void Thumb.fromPlainTextBlob(blob, cb); return void Thumb.fromPlainTextBlob(blob, cb);
} }
Thumb.fromImageBlob(blob, cb); if (blob.type.indexOf('image/') !== -1) {
return void Thumb.fromImageBlob(blob, cb);
}
return void cb('NO_THUMBNAIL');
}; };
window.html2canvas = undefined; window.html2canvas = undefined;

Loading…
Cancel
Save