Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 3751ea5

Browse files
author
mattpass
committed
Stricter checks on file MIME type
1 parent b51445c commit 3751ea5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/indexer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ function phpGrep($path, $base) {
5353
continue;
5454
}
5555
$finfo = "text";
56-
// Must have a MIME type string starting with "text"
56+
// Must have a MIME type string starting with "text" (also avoids "empty" files)
5757
if (function_exists('finfo_open')) {
5858
$finfoMIME = finfo_open(FILEINFO_MIME);
5959
$finfo = finfo_file($finfoMIME, $filePath);
6060
}
61-
if (strpos($finfo, "text")) {
61+
if (0 !== strpos($finfo, "text")) {
6262
continue;
6363
}
6464
// Check if file appears to be the same (same size and mtime), if so, continue as we'll assume it's not changed

0 commit comments

Comments
 (0)