From 50f2629901d145eeac6facfe5edeb2dfd0ac639a Mon Sep 17 00:00:00 2001 From: Daniel Ursache Dogariu Date: Tue, 9 Jul 2024 14:36:09 +0300 Subject: [PATCH] Use no file extension for S3 imports if mimetypes detects it as .bin --- backend/hub/workers/update_organization.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/hub/workers/update_organization.py b/backend/hub/workers/update_organization.py index 614f2b82..168b990a 100644 --- a/backend/hub/workers/update_organization.py +++ b/backend/hub/workers/update_organization.py @@ -45,6 +45,9 @@ def copy_file_from_to_organization(organization: Organization, signed_file_url: logger.info(f"{file_type.upper()} file request status = {r.status_code}") else: extension: str = mimetypes.guess_extension(r.headers["content-type"]) + # TODO: mimetypes thinks that some S3 documents are .bin files, which is useless + if extension == ".bin": + extension = "" with tempfile.TemporaryFile() as fp: fp.write(r.content) fp.seek(0)