Skip to content

Commit

Permalink
Add sizes to file entries (fixes #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jan 28, 2020
1 parent d3ee0c6 commit 973c7b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chord_drop_box_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def recursively_build_directory_tree(directory, level=0):
"path": os.path.abspath(os.path.join(directory, entry)),
"contents": recursively_build_directory_tree(os.path.join(directory, entry), level=level+1)}
if os.path.isdir(os.path.join(directory, entry))
else {"name": entry, "path": os.path.abspath(os.path.join(directory, entry))}
else {"name": entry,
"path": os.path.abspath(os.path.join(directory, entry)),
"size": os.path.getsize(os.path.join(directory, entry))}
for entry in os.listdir(directory)
if (level < TRAVERSAL_LIMIT or not os.path.isdir(os.path.join(directory, entry))) and entry[0] != ".")

Expand Down

0 comments on commit 973c7b4

Please sign in to comment.