Skip to content

Commit

Permalink
Add the root folder node under the root zip node
Browse files Browse the repository at this point in the history
|- root-folder.zip
   |- root-folder/
      |- folder_1/
         |- file_1.a
      |- file_2.b
  • Loading branch information
cslzchen committed Aug 13, 2018
1 parent 0bb276d commit 737e53a
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions mfr/extensions/zip/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,9 @@ def sorted_obj_list_to_tree(self, sorted_obj_list: list) -> List[dict]:
path_from_root = obj.filename
print(path_from_root)
path_segments = [segment for segment in path_from_root.split('/') if segment]
# Ignore the root tree node
if len(path_segments) == 1:
continue
# Find the parent node of the current object, always start from the root node
parent = tree_root
for index, segment in enumerate(path_segments):
# the first segment is the tree node, skip
if index == 0:
continue
# last segment is the current object, parents must have been found, end loop
if index == len(path_segments) - 1:
break
Expand Down

0 comments on commit 737e53a

Please sign in to comment.