Bring up to date with master

This commit is contained in:
j433866 2019-03-13 09:17:43 +00:00
commit 308195279c
47 changed files with 4209 additions and 703 deletions

View file

@ -8,7 +8,7 @@ import Operation from "../Operation";
import OperationError from "../errors/OperationError";
import { generateQrCode } from "../lib/QRCode";
import { toBase64 } from "../lib/Base64";
import Magic from "../lib/Magic";
import { isImage } from "../lib/FileType";
import Utils from "../Utils";
/**
@ -80,9 +80,9 @@ class GenerateQRCode extends Operation {
if (format === "PNG") {
let dataURI = "data:";
const type = Magic.magicFileType(data);
if (type && type.mime.indexOf("image") === 0){
dataURI += type.mime + ";";
const mime = isImage(data);
if (mime){
dataURI += mime + ";";
} else {
throw new OperationError("Invalid PNG file generated by QR image");
}