Merge pull request #1194 from SamBrishes/patch-002

[BUGFIX] ZIP Paths may starts with an (back-) slash
This commit is contained in:
Diego Najar 2020-05-15 13:35:41 +02:00 committed by GitHub
commit 4a740ecb03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -175,9 +175,9 @@ class Filesystem {
foreach ($files as $file) { foreach ($files as $file) {
$file = realpath($file); $file = realpath($file);
if (is_dir($file)) { if (is_dir($file)) {
$zip->addEmptyDir(str_replace($source, '', $file)); $zip->addEmptyDir(ltrim(str_replace($source, '', $file), "/\\"));
} elseif (is_file($file)) { } elseif (is_file($file)) {
$zip->addFromString(str_replace($source, '', $file), file_get_contents($file)); $zip->addFromString(ltrim(str_replace($source, '', $file), "/\\"), file_get_contents($file));
} }
} }
} elseif (is_file($source)) { } elseif (is_file($source)) {