From eb96103478fe83dab45e1bd0cec48c2dfc63743e Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Sat, 7 Sep 2019 19:32:51 +0200 Subject: [PATCH] Sanitiy check detected names if we got a mime --- lib/manager/preroller.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/manager/preroller.ts b/lib/manager/preroller.ts index c2d95ac..ce1e904 100644 --- a/lib/manager/preroller.ts +++ b/lib/manager/preroller.ts @@ -174,6 +174,12 @@ export class Preroller { if (!MimeDB.hasExtension(p.ext)) { continue; } + if (rv.mime) { + const mime = MimeDB.getMime(rv.mime); + if (mime && !mime.extensions.has(p.ext.toLowerCase())) { + continue; + } + } const sanitized = sanitizePath(p.name); if (sanitized.length <= detected.length) { continue;