mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-24 09:58:43 -04:00
Fix bug with large file uploads
Depending on the size of the uploaded file, Flask will temporarily store it in different ways. This means that it comes back as a `TempFile` if the file is roughly <500k and as `BytesIO` if the file is larger. `TempFile` supports the `.getvalue()` method, but `BytesIO` does not. Both support the `.read()` method, so this commit changes to use that instead.
This commit is contained in:
@@ -110,7 +110,7 @@ def send_messages(service_id, template_id):
|
||||
service_id,
|
||||
{
|
||||
'file_name': form.file.data.filename,
|
||||
'data': form.file.data.getvalue().decode('utf-8')
|
||||
'data': form.file.data.read().decode('utf-8')
|
||||
},
|
||||
current_app.config['AWS_REGION']
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user