Skip to content

Commit

Permalink
Use no file extension for S3 imports if mimetypes detects it as .bin
Browse files Browse the repository at this point in the history
  • Loading branch information
danniel committed Jul 9, 2024
1 parent 7d668db commit 50f2629
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/hub/workers/update_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 50f2629

Please sign in to comment.