Slight modification to how we match the mime

This commit is contained in:
n1073645 2019-12-06 12:39:32 +00:00
parent ee37731858
commit 730ee4f660
2 changed files with 4 additions and 7 deletions

View file

@ -5,7 +5,7 @@ import Dish from "../Dish.mjs";
import {detectFileType} from "./FileType.mjs"; import {detectFileType} from "./FileType.mjs";
import chiSquared from "chi-squared"; import chiSquared from "chi-squared";
import potentialOps from "./Test.mjs"; import potentialOps from "./Test.mjs";
import { isImage } from "./FileType.mjs"; import { isType } from "./FileType.mjs";
/** /**
* A class for detecting encodings, file types and byte frequencies and * A class for detecting encodings, file types and byte frequencies and
@ -253,11 +253,8 @@ class Magic {
* @returns {boolean} * @returns {boolean}
*/ */
async checkMime (data, type) { async checkMime (data, type) {
switch (type) { if (isType(type, data)) {
case "Image": return false;
if (isImage(data))
return false;
break;
} }
return true; return true;
} }

View file

@ -47,7 +47,7 @@ class RenderImage extends Operation {
], ],
null, null,
{ {
type: "Image", type: "image"
} }
); );
} }