mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
- zip folder fix for sisters directories
This commit is contained in:
@@ -742,27 +742,34 @@ function remove_accents($string) {
|
||||
* Get all files from folder and get their folder location in VueFileManager directories
|
||||
*
|
||||
* @param $folders
|
||||
* @param array $files
|
||||
* @param null $files
|
||||
* @param array $path
|
||||
* @return array
|
||||
*/
|
||||
function get_files_for_zip($folders, $files = [], $path = [])
|
||||
function get_files_for_zip($folders, $files, $path = [])
|
||||
{
|
||||
// Return file list
|
||||
if (!isset($folders->folders)) {
|
||||
return $files;
|
||||
return $files->unique()->values()->all();
|
||||
}
|
||||
|
||||
// Push path
|
||||
// Push file path
|
||||
array_push($path, $folders->name);
|
||||
|
||||
// Write file list
|
||||
foreach ($folders->files as $file) {
|
||||
array_push($files, [
|
||||
// Push file to collection
|
||||
$folders->files->each(function ($file) use ($files, $path) {
|
||||
$files->push([
|
||||
'name' => $file->name,
|
||||
'basename' => $file->basename,
|
||||
'folder_path' => implode('/', $path),
|
||||
]);
|
||||
});
|
||||
|
||||
// Get all children folders and folders within
|
||||
if ($folders->folders->isNotEmpty()) {
|
||||
$folders->folders->map(function ($folder) use ($files, $path) {
|
||||
return get_files_for_zip($folder, $files, $path);
|
||||
});
|
||||
}
|
||||
|
||||
return get_files_for_zip($folders->folders->first(), $files, $path);
|
||||
|
||||
@@ -30,6 +30,7 @@ class Editor
|
||||
* Zip requested folder
|
||||
*
|
||||
* @param $unique_id
|
||||
* @param $shared
|
||||
* @return mixed
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
@@ -42,8 +43,7 @@ class Editor
|
||||
->with('folders')
|
||||
->first();
|
||||
|
||||
|
||||
$files = get_files_for_zip($requested_folder);
|
||||
$files = get_files_for_zip($requested_folder, collect([]));
|
||||
|
||||
// Local storage instance
|
||||
$disk_local = Storage::disk('local');
|
||||
|
||||
Reference in New Issue
Block a user