-
Notifications
You must be signed in to change notification settings - Fork 133
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
Redirect client to download media directly from Amazon S3 / Azure Storage #2713
Conversation
ce20376
to
782fcdb
Compare
7fdea77
to
1ac4f0c
Compare
# # Anonymous user cannot view private EntityList | ||
# request = self.factory.get("/") | ||
# response = self.view(request, pk=self.entity_list.pk) | ||
# self.assertEqual(response.status_code, 404) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that anonymous users can now view private EntityLists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrankApiyo Nice catch, I don't think this was intentional
request = self.factory.get("/export") | ||
force_authenticate(request, user=self.user) | ||
response = self.view(request, pk=export.pk) | ||
self.assertEqual(response.status_code, 302, response.url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the 3rd argument to assertEqual
do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrankApiyo I copied the assertion from a previous implementation. I will remove it since the 3rd argument should be the message displayed if the assertion fails.
return f"attachment; filename={name}.{extension}" | ||
# The filename is enclosed in quotes because it ensures that special characters, | ||
# spaces, or punctuation in the filename are correctly interpreted by browsers | ||
# and clients. This is particularly important for filenames that may contain | ||
# spaces or non-ASCII characters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏿 👍🏿
6a6afb5
to
92f95aa
Compare
Changes / Features implemented
Redirect client to download media directly from Amazon S3 / Azure Storage. Before, the server was responsible for reading the file contents and streaming the data back to the client. This implementation was prone to timeouts if the file is large and required the server to adjust UWSGI and Nginx timeouts to large values.
Deployments that choose to use local storage are not affected by the change.
Steps taken to verify this change does what is intended
Side effects of implementing this change
Prevents large exports from timing out
Before submitting this PR for review, please make sure you have:
Closes #