Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix folder downloads entirely not working #366

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions gdown/download_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ def _get_directory_structure(gdrive_file, previous_path):

directory_structure = []
for file in gdrive_file.children:
file.name = file.name.replace(osp.sep, "_")
# Replace path separators and remove leading/trailing whitespace
file.name = file.name.replace(osp.sep, "_").strip()
if file.is_folder():
directory_structure.append((None, osp.join(previous_path, file.name)))
for i in _get_directory_structure(file, osp.join(previous_path, file.name)):
new_path = osp.join(previous_path, file.name)
directory_structure.append((None, new_path))
for i in _get_directory_structure(file, new_path):
directory_structure.append(i)
elif not file.children:
directory_structure.append((file.id, osp.join(previous_path, file.name)))
new_path = osp.join(previous_path, file.name)
directory_structure.append((file.id, new_path))
return directory_structure


Expand Down