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

feat: allow to download multiple files and folders #16

Merged
merged 11 commits into from
Nov 24, 2023
Merged

Conversation

Ian2012
Copy link
Contributor

@Ian2012 Ian2012 commented Nov 8, 2023

Description

This PR allows to download of multiple files in a zip file. It does so by creating a celery task with the contents to download, and it creates the zip file and uploads it to the default django storage. The task ID is returned so that the client can perform long pulling to verify the state of the task. Once the task status is SUCCESS, the download URL is returned as part of the task result and the file is automatically downloaded for the client in a file called download.zip

This implementation support folders and files.

image

@Ian2012 Ian2012 changed the title Cag/download files feat: allow to download multiple files and folders Nov 9, 2023
@Ian2012 Ian2012 marked this pull request as ready for review November 9, 2023 20:55
@mariajgrimaldi mariajgrimaldi requested a review from a team November 14, 2023 21:31
@mariajgrimaldi
Copy link
Contributor

mariajgrimaldi commented Nov 14, 2023

Remember adding (minimal) unittests for this new implementation

@mariajgrimaldi
Copy link
Contributor

@Ian2012: I tried it but it's not working for me. It stays polling the task status, do I need some setup done in my local environment?

@mariajgrimaldi
Copy link
Contributor

Also, can we add a message indicating that the download is in progress? So the user waits for it

@Ian2012 Ian2012 force-pushed the cag/download-files branch 8 times, most recently from 1d8fe9d to 441fb5c Compare November 22, 2023 16:21
@Ian2012 Ian2012 changed the base branch from main to MJG/configure-ci November 22, 2023 16:21
@Ian2012 Ian2012 changed the base branch from MJG/configure-ci to main November 22, 2023 16:21
@Ian2012 Ian2012 force-pushed the cag/download-files branch 7 times, most recently from 0767301 to fd14876 Compare November 22, 2023 18:13
test: adjust docstrings

docs: fix indentation issues
for content in folder_structure:
if asset_key:=content.get("asset_key"):
file_content = contentstore().find(AssetKey.from_string(asset_key))
ziph.writestr(zinfo_or_arcname=content["path"], data=file_content.data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ziph.writestr(zinfo_or_arcname=content["path"], data=file_content.data)
ziph.writestr(zinfo_or_arcname=content["path"], data=file_content.data)

Copy link
Contributor

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@Ian2012 Ian2012 merged commit 9199dd4 into main Nov 24, 2023
@mariajgrimaldi mariajgrimaldi deleted the cag/download-files branch November 24, 2023 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants