From b8be5a6c257ca39a265b98871ef367234e423522 Mon Sep 17 00:00:00 2001 From: Roberto Federici Date: Fri, 5 May 2017 15:12:06 +0200 Subject: [PATCH] Update Zip.php Dont remove the first char of filename if no path is specified --- src/Zip.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Zip.php b/src/Zip.php index 3b00341..f31b4cf 100644 --- a/src/Zip.php +++ b/src/Zip.php @@ -237,7 +237,10 @@ public function zip_end() { // add each file foreach ($this->org_files as $org_file_path) { // get file name from the path - $name = substr($org_file_path,strrpos($org_file_path,"/")+1); + //dont remove first char of filename if no path is specified + if( strpos($org_file_path, "/") !== false ){ + $name = substr($org_file_path,strrpos($org_file_path,"/")+1); + } // add the file to the archive $lib->addFile($org_file_path,$name); } @@ -493,4 +496,4 @@ private function path() { return join(DIRECTORY_SEPARATOR, func_get_args()); } -} \ No newline at end of file +}