h2non/filetype.py

filetype.guess not working with bytes when used in AWS Lambda environment

miguel-martinr opened this issue · 0 comments

I've this code that works just fine locally:

file_bytes = file.file.read()
kind = filetype.guess(file_bytes)

file type is UploadFile from FastAPI. So, file.read() returns a bytes object.

I'm using python 3.10 both locally and in AWS Lambda, but for some reason, in the Lambda environment the result from guess is None for any given file.

FWIW: both local and lambda env are using little endian (?