1
0
Fork 0
pull/9465/head
Jordi Boggiano 2021-01-12 13:04:32 +01:00 committed by GitHub
parent abbc0e8a4e
commit 598beb240a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 12 deletions

View File

@ -130,19 +130,14 @@ abstract class BaseExcludeFilter
$rule = ltrim($rule, '!'); $rule = ltrim($rule, '!');
} }
if ($rule !== '') { $firstSlashPosition = strpos($rule, '/');
if ($rule[0] === '/') { if (0 === $firstSlashPosition) {
$pattern = '^/'; $pattern = '^/';
} else { } elseif (false === $firstSlashPosition || strlen($rule) - 1 === $firstSlashPosition) {
$first_slash_position = strpos($rule, '/');
if (false === $first_slash_position || strlen($rule) - 1 === $first_slash_position) {
$pattern = '/'; $pattern = '/';
} }
}
$rule = trim($rule, '/'); $rule = trim($rule, '/');
}
// remove delimiters as well as caret (^) and dollar sign ($) from the regex // remove delimiters as well as caret (^) and dollar sign ($) from the regex
$rule = substr(Finder\Glob::toRegex($rule), 2, -2); $rule = substr(Finder\Glob::toRegex($rule), 2, -2);