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, '!');
}
if ($rule !== '') {
if ($rule[0] === '/') {
$firstSlashPosition = strpos($rule, '/');
if (0 === $firstSlashPosition) {
$pattern = '^/';
} else {
$first_slash_position = strpos($rule, '/');
if (false === $first_slash_position || strlen($rule) - 1 === $first_slash_position) {
} elseif (false === $firstSlashPosition || strlen($rule) - 1 === $firstSlashPosition) {
$pattern = '/';
}
}
$rule = trim($rule, '/');
}
// remove delimiters as well as caret (^) and dollar sign ($) from the regex
$rule = substr(Finder\Glob::toRegex($rule), 2, -2);