Skip to content

Commit

Permalink
feature(tree-files): handle files with empty folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed May 30, 2024
1 parent a92f8cf commit 51c041e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qgis_deployment_toolbelt/utils/tree_files_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ def tree_to_download_list(tree_array: list[Treeitem], rel_path: str = "") -> lis
"""
li_files = []

if not isinstance(tree_array, (list, tuple)):
return li_files

for item in tree_array:
if item.get("type") == "directory":
if item.get("name") != ".":
new_rel_path = f"{rel_path}/{item.get('name')}"
else:
new_rel_path = f"{item.get('name')}"

if "contents" in item:
li_files.extend(
tree_to_download_list(
tree_array=item.get("contents"),
Expand Down

0 comments on commit 51c041e

Please sign in to comment.