From c24bd17818cb7a2e0593c97883e5438372ee8a6d Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Thu, 11 May 2023 23:05:11 +0200 Subject: [PATCH] chore(filecheck/checker): make binary file check clearer --- filecheck/checker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/filecheck/checker.ts b/filecheck/checker.ts index 150a68135b18..742bf51baff7 100644 --- a/filecheck/checker.ts +++ b/filecheck/checker.ts @@ -28,7 +28,7 @@ import { const { default: imageminPngquant } = imageminPngquantPkg; -const BINARY_FILE_REGEXP = createRegExpFromExtensions( +const BINARY_NON_IMAGE_FILE_REGEXP = createRegExpFromExtensions( ...AUDIO_EXT, ...VIDEO_EXT, ...FONT_EXT @@ -89,7 +89,8 @@ export async function checkFile( } // Ensure that binary files contain what their extension indicates. - if (BINARY_FILE_REGEXP.test(filePath)) { + // Exclude images, as they're checked separately in checkCompression(). + if (BINARY_NON_IMAGE_FILE_REGEXP.test(filePath)) { const ext = filePath.split(".").pop(); const type = await fileTypeFromFile(filePath); if (!type) {