From bb7487c4763ea10cb015d00a5089ab8a6c0727b4 Mon Sep 17 00:00:00 2001 From: j433866 Date: Wed, 13 Mar 2019 09:20:13 +0000 Subject: [PATCH] Change to use new FileType library --- src/core/operations/ParseQRCode.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/operations/ParseQRCode.mjs b/src/core/operations/ParseQRCode.mjs index d929500b..63646b79 100644 --- a/src/core/operations/ParseQRCode.mjs +++ b/src/core/operations/ParseQRCode.mjs @@ -6,7 +6,7 @@ import Operation from "../Operation"; import OperationError from "../errors/OperationError"; -import Magic from "../lib/Magic"; +import { isImage } from "../lib/FileType.mjs"; import { parseQrCode } from "../lib/QRCode"; /** @@ -50,9 +50,8 @@ class ParseQRCode extends Operation { */ async run(input, args) { const [normalise] = args; - const type = Magic.magicFileType(input); - if (!type || type.mime.indexOf("image") !== 0) { + if (!isImage(input)) { throw new OperationError("Invalid file type."); } return await parseQrCode(input, normalise);