Skip to content

Commit

Permalink
chore(filecheck/checker): make binary file check clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed May 19, 2023
1 parent 33ec69f commit c24bd17
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions filecheck/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c24bd17

Please sign in to comment.