Override content type before creating file document in MongoDB
This commit is contained in:
@@ -536,14 +536,13 @@ def stream_to_gcs(project_id):
|
|||||||
authentication.current_user_id())
|
authentication.current_user_id())
|
||||||
uploaded_file = request.files['file']
|
uploaded_file = request.files['file']
|
||||||
|
|
||||||
file_id, internal_fname, status = create_file_doc_for_upload(project_oid, uploaded_file)
|
|
||||||
|
|
||||||
override_content_type(uploaded_file)
|
override_content_type(uploaded_file)
|
||||||
|
|
||||||
if not uploaded_file.content_type:
|
if not uploaded_file.content_type:
|
||||||
log.warning('File uploaded to project %s without content type.', project_oid)
|
log.warning('File uploaded to project %s without content type.', project_oid)
|
||||||
raise BadRequest('Missing content type.')
|
raise BadRequest('Missing content type.')
|
||||||
|
|
||||||
|
file_id, internal_fname, status = create_file_doc_for_upload(project_oid, uploaded_file)
|
||||||
|
|
||||||
if uploaded_file.content_type.startswith('image/'):
|
if uploaded_file.content_type.startswith('image/'):
|
||||||
# We need to do local thumbnailing, so we have to write the stream
|
# We need to do local thumbnailing, so we have to write the stream
|
||||||
# both to Google Cloud Storage and to local storage.
|
# both to Google Cloud Storage and to local storage.
|
||||||
|
Reference in New Issue
Block a user