Skip to content

Commit 3f1801e

Browse files
committed
Postfix comparison to check path
Establish a stringExtra value of a slash or nothing depending on wether we are considering the root level or not When comparing the folder against the selectedFile array value, postfix both with a slash (could be any char though). This is to eliminate path mismatches.
1 parent ca8e92e commit 3f1801e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/multiple-results.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ function phpGrep($q, $path, $base) {
129129
}
130130
$findPath = str_replace($base,"",$fullPath);
131131
for ($i=0;$i<count($selectedFiles);$i++) {
132-
if (strpos($findPath,str_replace("|","/",$selectedFiles[$i]))===0) {
132+
$stringExtra = $selectedFiles[$i] != "|" ? "/" : "";
133+
if (strpos($findPath.$stringExtra,str_replace("|","/",$selectedFiles[$i]).$stringExtra)===0) {
133134
$foundInSelFile = true;
134135
}
135136
}

0 commit comments

Comments
 (0)