diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 54197e17..56b0f81e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ========= +0.16.11 - Unreleased +------------------------- +- Fix #267: Include only accessible folders and files in a downloading zip archive + 0.16.10 - August 1, 2025 ------------------------- Warning: This release contains two [security fixes](https://github.com/humhub/cfiles/security/advisories), and an update is strongly recommended. diff --git a/libs/ZIPCreator.php b/libs/ZIPCreator.php index e3135a41..734ee9d6 100644 --- a/libs/ZIPCreator.php +++ b/libs/ZIPCreator.php @@ -101,7 +101,7 @@ public function addFile($file, $path = '', $fileName = null) $file = $file->baseFile; } - if (!$file) { + if (!$file || !$file->canView()) { return; } @@ -127,12 +127,16 @@ public function addFile($file, $path = '', $fileName = null) */ public function addFolder(Folder $folder, $path = '') { + if (!$folder->content->canView()) { + return; + } + $path = $this->fixPath($path . DIRECTORY_SEPARATOR . $folder->title); $this->archive->addEmptyDir($path); - $subFiles = CFile::find()->where(['parent_folder_id' => $folder->id])->all(); - $subFolders = Folder::find()->where(['parent_folder_id' => $folder->id])->all(); + $subFiles = CFile::find()->readable()->where(['parent_folder_id' => $folder->id])->all(); + $subFolders = Folder::find()->readable()->where(['parent_folder_id' => $folder->id])->all(); foreach ($subFiles as $file) { $this->addFile($file, $path); diff --git a/module.json b/module.json index fff42090..15a34f8d 100644 --- a/module.json +++ b/module.json @@ -9,7 +9,7 @@ "organisation", "sharing" ], - "version": "0.16.10", + "version": "0.16.11", "humhub": { "minVersion": "1.14" },