Open file in binary mode
This commit is contained in:
parent
0915ec019b
commit
c903c73270
|
@ -116,7 +116,7 @@ def analyze_image(request: Request, image: UploadFile):
|
||||||
base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url))
|
base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url))
|
||||||
infile = incoming_dir / image.filename
|
infile = incoming_dir / image.filename
|
||||||
file_hash = hashlib.sha256()
|
file_hash = hashlib.sha256()
|
||||||
with open(infile, "w") as f:
|
with open(infile, "wb") as f:
|
||||||
chunk = image.file.read(buffer_size)
|
chunk = image.file.read(buffer_size)
|
||||||
while chunk:
|
while chunk:
|
||||||
file_hash.update(chunk)
|
file_hash.update(chunk)
|
||||||
|
|
Loading…
Reference in New Issue