Match paths sent to theme:sync more exactly (#5334)

`artisan theme:sync --target=database --force --paths=layouts/,pages/,partials/`

But at the moment it also synchronizes paths that should not be synchronized. For example: `content/static-pages/`. Because here the pattern applies to `pages/`.

The fix is that the pattern starts at the beginning of the line.

Co-authored-by: Heiko Böhme <hboehme@menadwork.com>
This commit is contained in:
hackolein 2020-11-20 10:02:10 +01:00 committed by GitHub
parent 00849268ed
commit 96fd2ec657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ class ThemeSync extends Command
foreach ($userPaths as $userPath) {
foreach ($themePaths as $themePath) {
$pregMatch = '/' . str_replace('/', '\/', $userPath) . '/i';
$pregMatch = '/^' . str_replace('/', '\/', $userPath) . '/i';
if ($userPath === $themePath || preg_match($pregMatch, $themePath)) {
$paths[] = $themePath;