iGEM-HBUT-China / igem-uploads

igem-uploads helps iGEMers upload their files to the iGEM server.
https://gitlab.igem.org/2023/software-tools/hbut-china
Creative Commons Attribution 4.0 International
5 stars 0 forks source link

WebP file mime type inferred wrongly as text/plain #2

Open Prater-12 opened 1 month ago

Prater-12 commented 1 month ago

Issue

When one tries to upload a WebP file via the API, the upload fails with the following error:

client.upload("temp/41_jpg.webp", "public") 
# {"message":"File mime-type \"text/plain\" not allowed.","error":"Unprocessable Entity","statusCode":422}

Possible Cause

The strict check used to guess mime type seems to be excluding image/webp

  mime_type = mimetypes.guess_type(abs_file_path, True)[0] # None
  print(mimetypes.guess_type(abs_file_path, True)) # (None, None)
  print(mimetypes.guess_type(abs_file_path, False)) # ('image/webp', None)
lty2002 commented 1 month ago

I tried on my mac(Python 3.12), it works. Could you please talk more about your situation?