Skip to content

Commit

Permalink
[BUGFIX] Properly separate exclude checks for files and directories (#55
Browse files Browse the repository at this point in the history
)
  • Loading branch information
o-ba authored Apr 19, 2022
1 parent b12e49f commit cb531d1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Service/VersionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,21 @@ public function createZipArchiveFromPath(string $path): string
return false;
}

// check directories
foreach ($this->excludeConfiguration['directories'] as $excludeDirectory) {
if (preg_match('/^' . $excludeDirectory . '/i', $path)) {
return false;
if ($current->isDir()) {
// if $current is a directory, check for excluded directories
foreach ($this->excludeConfiguration['directories'] as $excludeDirectory) {
if (preg_match('/^' . $excludeDirectory . '/i', $path)) {
return false;
}
}
}
// check files
foreach ($this->excludeConfiguration['files'] as $excludeFile) {
if (preg_match('/' . $excludeFile . '$/i', $filename)) {
return false;

if ($current->isFile()) {
// if $current is a file, check for excluded files
foreach ($this->excludeConfiguration['files'] as $excludeFile) {
if (preg_match('/' . $excludeFile . '$/i', $filename)) {
return false;
}
}
}

Expand Down

0 comments on commit cb531d1

Please sign in to comment.